Re: del session variables

2008-11-20 Thread Andy McKay

On 20 Nov 2008, at 22:06, Bobby Roberts wrote:
> is there a way to kill a session rather than running a del statement
> on each session variable?  I know in .asp you can simply say
> session.abandon.  Is there an equivalent with django?


In the session documentation there are mentions of: clear() and flush()

http://docs.djangoproject.com/en/dev/topics/http/sessions/#topics-http-sessions

Sounds like one of those might be helpful.
--
   Andy McKay
   Clearwind Consulting

   Site: www.clearwind.ca
   Blog: www.agmweb.ca/blog/andy






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



Re: del session variables

2008-11-20 Thread Malcolm Tredinnick


On Thu, 2008-11-20 at 14:06 -0800, Bobby Roberts wrote:
> is there a way to kill a session rather than running a del statement
> on each session variable?  I know in .asp you can simply say
> session.abandon.  Is there an equivalent with django?

Django has this really nifty feature (I believe ASP.NET has it too)
called "documentation". If you look at the documentation for the
sessions application, there's this section:

http://docs.djangoproject.com/en/dev/topics/http/sessions/#using-sessions-in-views

Have a look at the flush() method; I believe that might well be close to
what you are after.

Regards,
Malcolm


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



Re: del session variables

2008-12-17 Thread Bobby Roberts


> Have a look at theflush() method; I believe that might well be close to
> what you are after.
>
> Regards,
> Malcolm


I'm trying to call the view below:

def DoSessionReset(request):
request.session.flush()
return HttpResponseRedirect ('../shop')


I'm getting this error:

TypeError at /shop/start-new-order/
'str' object is not callable



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~--~~~~--~~--~--~---



Re: del session variables

2008-12-17 Thread Jeff FW

You've got a space in between "HttpResponseRedirect" and "('../
shop')" .

On Dec 17, 2:44 pm, Bobby Roberts  wrote:
> > Have a look at theflush() method; I believe that might well be close to
> > what you are after.
>
> > Regards,
> > Malcolm
>
> I'm trying to call the view below:
>
> def DoSessionReset(request):
>     request.session.flush()
>     return HttpResponseRedirect ('../shop')
>
> I'm getting this error:
>
> TypeError at /shop/start-new-order/
> 'str' object is not callable
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~--~~~~--~~--~--~---



Re: del session variables

2008-12-17 Thread Malcolm Tredinnick


On Wed, 2008-12-17 at 11:44 -0800, Bobby Roberts wrote:
> 
> > Have a look at theflush() method; I believe that might well be close to
> > what you are after.
> >
> > Regards,
> > Malcolm
> 
> 
> I'm trying to call the view below:
> 
> def DoSessionReset(request):
> request.session.flush()
> return HttpResponseRedirect ('../shop')
> 
> 
> I'm getting this error:
> 
> TypeError at /shop/start-new-order/
> 'str' object is not callable

You're getting a lot more than that, though. You're getting a full
tracreback that tells you where the problem is occurring, for a start.

Also, if the problem really is triggered by request.session being a
string, then something else is going wrong, since Django's session
middleware will never be setting it to a string.

So help us to help you here: give us the full traceback and try to work
out *what* is a string (and what the value of that string is) that is
being passed in unexpectedly.

Regards,
Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~--~~~~--~~--~--~---



Re: del session variables

2008-12-17 Thread Malcolm Tredinnick


On Wed, 2008-12-17 at 15:09 -0800, Jeff FW wrote:
> You've got a space in between "HttpResponseRedirect" and "('../
> shop')" .

Which is perfectly legal and unambiguous in Python. That isn't a
problem.

Regards,
Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~--~~~~--~~--~--~---



Re: del session variables

2008-12-20 Thread Jeff FW

Wow, you're right.  I've been programming Python for years, and I
somehow never noticed that.  I'll be quiet not :-)

On Dec 17, 6:33 pm, Malcolm Tredinnick 
wrote:
> On Wed, 2008-12-17 at 15:09 -0800, Jeff FW wrote:
> > You've got a space in between "HttpResponseRedirect" and "('../
> > shop')" .
>
> Which is perfectly legal and unambiguous in Python. That isn't a
> problem.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~--~~~~--~~--~--~---