ok! Being influenced by other frameworks I was expecting something
like this:

myvalue = request.vars.offset.defaults('some default value')

where defaults() would either return the actual value or the default
value (as seen in ZF: $myvalue = $request->getParam('offset', 'some
default value');).

But I understand the gain is not worth the pain since the python "if"
statement is explicit and already pretty short.

On Apr 21, 10:58 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> This is elegant.
>
> On 21 Apr, 14:57, desfrenes <desfre...@gmail.com> wrote:
>
> > Hi !
>
> > I was looking for a way to set default values to request.vars. I use
> > this:
>
> > if request.vars.offset == None: request.vars.offset = 0
>
> > But maybe there is a more elegant solution ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to