Am trying to get value from request.vars but end up getting a null value. My code:
if request.vars.message:
return request.vars.message
R = request.vars.message
return dict (R=R, form =form)
My vew.html {{=R}}
This prints none.
In your code, whenever request.vars.message
has a value, it immediately returns the value (inside the if
block). The only case in which the code reaches the return dict(...)
line at the end is when request.vars.message
is missing (technically, any falsey value, but in most cases it is probably None
, meaning there is no message
key in the request.vars
object).
If you want to send the value of message
to the view to be displayed, then do not return inside the if
block.