On Thursday, April 15, 2010 11:23:15 selecta wrote:
for request.args I can do
request.args(0)
and will return None if there is no such element, much nicer than
request.args[0] if len(request.args)0 else None
I always wondered why this does not work for request.vars I have the
On Apr 15, 2010, at 3:05 AM, Mladen Milankovic wrote:
q = request.vars.get('q', None)
You can put anything instead of None. It's like a default value.
Or just q = request.vars.get('q'), since None is the default.
This is standard dictionary behavior in Python. It and setdefault are
2 matches
Mail list logo