If I'm not mistaken, session object is a web.util.storage instance,
which is a dict subclass. So the get should do the same as what it
does for dict.
For example:
>>> import web
>>> a = web.storage()
>>> a.someattr = 12
>>> a.someattr
12
>>> a['someattr']
12
>>> a.get('someattr')
12
>>> a.get('someattr', 1)
12
>>> a.get('someotherattr', 1)
1
>>> a['someotherattr']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'someotherattr'
>>> a.get('someotherattr')
>>> print repr(a.get('someotherattr'))
None
In other words, the second argument to .get() is the default, which
itself defaults to None.
On Thu, Jan 21, 2010 at 5:04 PM, Ferran Fontcuberta <[email protected]> wrote:
> Is there any difference using session.get(N,Y) from session.get(N) ??
>
> Thank you
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.
>
>
>
>
--
Branko Vukelić
http://foxbunny.tumblr.com/
http://www.flickr.com/photos/16889...@n04/
http://www.twitter.com/foxbunny
http://github.com/foxbunny
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.