[mod_python] What is the proper way to delete a session member

Greg Fawcett greg at vig.co.nz
Tue May 15 19:58:07 EDT 2007


Hi Jeff -

Simply delete it...

    del(req.session['foo'])

Cheers!
Greg.

On 16/05/07, Jeff Hinrichs - DM&T <jeffh at dundeemt.com> wrote:
>
> Given:
> you have a session object, and there exists req.session['foo'] = bar
>
> How do you remove/delete the member 'foo'?  I want the session to
> remain except that the member 'foo' should not exist in the session
> object?
>
> Do I just set it to an empty string or None?  I could very well be
> blind to this information in the docs but I couldn't seem to find it.
> I recall that the session object looks like a dictionary but isn't a
> true dictionary.  So I'm not sure if I can use the del method
> del(req.session['foo'])
>
>
> Even a nudge to some where in the docs would be appreciated.
>
>
> Thanks,
>
> Jeff Hinrichs
> www.OmahaPython.org
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070516/9eb6bd63/attachment-0001.html


More information about the Mod_python mailing list