Im trying to follow the example given
here<https://groups.google.com/forum/?fromgroups=#!topic/web2py/yBBhvADGGB4%5B1-25%5D>for
manually rendering views.
I have this code in my controller:
def index():
global my_var
my_var = "something"
content = '''<html><body><h1>My Page</h1><p>
{{=my_var}}
{{=request.raw_args}}
</body></html>'''
output = render(content,context=dict(n=5))
return output
but this won't work- it gives an error:
> <type 'exceptions.NameError'> name 'my_var' is not defined
Questions:
- How do I create variables in the controller that can then be
referenced in the rendered view?
- Can I access global vars like request/response in the rendered view?
- what does the context dictionary do?
(I tried but couldn't make sense of the render function in template.py. I'm
clueless to the scoping consequences of this stuff...)
--