Michael wrote:
> Hello,
> I'm sure this is a easy question.
>
> In one of my views I need to delete the session variable
> 'request.session['percent']'. However, sometimes 'request.session
> ['percent']' never gets created. When this is the case I get an error
> when I do 'del request.session['
I haven't tried this (I'll try it when I get home), but looking at the
session code shows that you should be able to call:
request.session.delete()
to delete the whole session at once.
On Jul 3, 3:52 am, Daniel Hepper <[EMAIL PROTECTED]> wrote:
> Try:
>
> for key in request.session.keys():
>
Try:
for key in request.session.keys():
del request.session[key]
Regards,
Daniel Hepper
Am Mittwoch, den 02.07.2008, 20:57 -0700 schrieb Bobby Roberts:
> > for key in request.session:
> > del request.session[key]
>
>
> I get the following error:
>
> Exception Type: KeyError
> E
> for key in request.session:
> del request.session[key]
I get the following error:
Exception Type: KeyError
Exception Value:0
Exception Location: /usr/lib/python2.5/site-packages/django/contrib/
sessions/backends/base.py in __getitem__, line 31
--~--~-~--~~-
On Wed, 2008-07-02 at 11:52 -0700, Bobby Roberts wrote:
> > On Jul 2, 2:50 pm, "Juanjo Conti" <[EMAIL PROTECTED]> wrote:
> > You mean in the views?
> >
> > del request.session['somedata']
>
> Well If i have 15 session variables I don't want to have to do it for
> each variable.
>
for key in req
I am just guessing, but try:
request.session.clear()
2008/7/2 Bobby Roberts <[EMAIL PROTECTED]>:
>
>> On Jul 2, 2:50 pm, "Juanjo Conti" <[EMAIL PROTECTED]> wrote:
>> You mean in the views?
>>
>> del request.session['somedata']
>
> Well If i have 15 session variables I don't want to have to do it
> On Jul 2, 2:50 pm, "Juanjo Conti" <[EMAIL PROTECTED]> wrote:
> You mean in the views?
>
> del request.session['somedata']
Well If i have 15 session variables I don't want to have to do it for
each variable.
Is there something like del request.session.sessionid or something
that will kill all s
You mean in the views?
del request.session['somedata']
2008/7/2 Bobby Roberts <[EMAIL PROTECTED]>:
>
> i can't find a way to delete session data (other than user removing
> their cookie perhaps?) in the django docs. Is there an easy way to do
> this like in ASP?
> >
>
--
Juanjo Conti
--~--
8 matches
Mail list logo