| | 284 | - ''coming soon...'' |
| | 285 | |
| | 286 | ==== Passing information between main controller & pre-processor ==== |
| | 287 | |
| | 288 | Scope normally means that these 2 sections can only talk to each other via globals or the Request object. |
| | 289 | |
| | 290 | If you need to pass data between them, you can use this trick: |
| | 291 | {{{ |
| | 292 | vars = {} # the surrounding dict |
| | 293 | def prep(r, vars): |
| | 294 | vars.update(x=y) # the actual variable to pass is x |
| | 295 | return True |
| | 296 | |
| | 297 | response.s3.prep = lambda r, vars=vars: prep(r, vars) |
| | 298 | |
| | 299 | output = shn_rest_controller(module, resource) |
| | 300 | |
| | 301 | x = vars.get(x, None) |
| | 302 | }}} |
| | 303 | |
| | 304 | An example usage is in {{{controllers/gis.py}}} for location() |