| 420 | | |
|---|
| 421 | | def __getattribute__(self, name): |
|---|
| 422 | | attr = object.__getattribute__(self, name) |
|---|
| 423 | | if name == "kwargs": |
|---|
| 424 | | if attr: |
|---|
| 425 | | kwargs = cherrypy.request.params.copy() |
|---|
| 426 | | kwargs.update(attr) |
|---|
| 427 | | else: |
|---|
| 428 | | kwargs = cherrypy.request.params |
|---|
| 429 | | return kwargs |
|---|
| 430 | | else: |
|---|
| 431 | | return attr |
|---|
| | 420 | """When passing cherrypy.request.params to the page handler, we don't |
|---|
| | 421 | want to capture that dict too early; we want to give tools like the |
|---|
| | 422 | decoding tool a chance to modify the params dict in-between the lookup |
|---|
| | 423 | of the handler and the actual calling of the handler. This subclass |
|---|
| | 424 | takes that into account, and allows request.params to be 'bound late' |
|---|
| | 425 | (it's more complicated than that, but that's the effect). |
|---|
| | 426 | """ |
|---|
| | 427 | |
|---|
| | 428 | def _get_kwargs(self): |
|---|
| | 429 | kwargs = cherrypy.request.params.copy() |
|---|
| | 430 | if self._kwargs: |
|---|
| | 431 | kwargs.update(self._kwargs) |
|---|
| | 432 | return kwargs |
|---|
| | 433 | |
|---|
| | 434 | def _set_kwargs(self, kwargs): |
|---|
| | 435 | self._kwargs = kwargs |
|---|
| | 436 | |
|---|
| | 437 | kwargs = property(_get_kwargs, _set_kwargs, |
|---|
| | 438 | doc='page handler kwargs (with ' |
|---|
| | 439 | 'cherrypy.request.params copied in)') |
|---|