The list of global variables defined in models and passed to the
controllers are also passed to the view (for example the views see db,
request, session, etc. globals variables defined in controllers are
not passes to the view unless done explicitely.

On Jan 5, 8:03 am, Peter O <[email protected]> wrote:
> Hihi,
>
> I am baffled by what I see between Example 1 and 2.
>
> It may be a good case to improve my understanding of the run-time
> environment of web2py.
>
> Thanks in advance for any comments.
>
> VIEW: (test.html)
>
> <html>  <body>
> {{=globals().get('t1', False)}}
>  </body> </html>
>
> CONTROLLER:
>
> == Example 1 ==
>
> def test():
>     global t1
>     t1 = True
>     return dict() # the browser show 'False'. I was expecting 'True'
>
> == Example 2 ==
>
> def test():
>     global t1
>     t1 = True
>
>     response.render('default/test.html', globals() ) #the return is
> discarded
>
>     return dict() # the browser show 'True'. I was expecting the same
> result as Example 1.

Reply via email to