Thanks David,
Makes sense .

On Feb 26, 9:39 am, David De La Harpe Golden
<david.delaharpe.gol...@ichec.ie> wrote:
> On 26/02/10 16:50, Sumanth wrote:
>
> > Hi ,
>
> > I was trying to access the session key using request.session object in
> > django.  To do this we can use
> > request.session._session_key or request.session.session_key out of
> > this which is the right one to use ?
>
> The latter, without the leading underscore. This is really a python
> question -  A leading underscore '_' is a standard python naming
> convention for "consider this private":
>
> http://www.python.org/dev/peps/pep-0008/
>
> The privacy is not rigidly enforced like some languages, however things
> like "import *" do respect it by default.
>
> > But would like to know why _session_key returns None for first
> > time .
>
> Probably because it's lazily maintained - accessing session_key
> will call _get_session_key (it's property wrapped), which
> will wind up setting the private _session_key - if it's not already set.
>
> http://docs.python.org/library/functions.html#property
>
> http://code.djangoproject.com/browser/django/trunk/django/contrib/ses...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to