1 """Standard TurboGears request hooks for CherryPy."""
2
3 __all__ = ['NestedVariablesHook']
4
5 from cherrypy import request
6 from formencode.variabledecode import NestedVariables
7
8
10 """Request filter for handling nested variables.
11
12 Turns request parameters with names in special dotted notation into
13 nested dictionaries via the FormEncode NestedVariables validator.
14
15 Stores the original parameters in the 'original_params' attribute.
16
17 """
18 try:
19 params = request.params
20 except AttributeError:
21 pass
22 else:
23 request.original_params = params
24 request.params = NestedVariables.to_python(params or {})
25