| 153 | ==== Passing information between main Controller & Prep ==== |
| 154 | Scope normally means that these 2 sections can only talk to each other via globals or the Request object. |
| 155 | |
| 156 | If you need to pass data between them, you can use this trick: |
| 157 | {{{ |
| 158 | vars = {} # the surrounding dict |
| 159 | def prep(r, vars): |
| 160 | vars.update(x=y) # the actual variable to pass is x |
| 161 | return True |
| 162 | |
| 163 | response.s3.prep = lambda r, vars=vars: prep(r, vars) |
| 164 | |
| 165 | output = shn_rest_controller(module, resource) |
| 166 | |
| 167 | x = vars.get(x, None) |
| 168 | }}} |
| 169 | |
| 170 | An example usage is in {{{controllers/gis.py}}} for location() |