Re: How do you get and set cookies in django
On 9/8/06, mthorley <[EMAIL PROTECTED]> wrote: > This may be a really dumb one, but I'm stooped. I read about > request.COOKIES, and request.session.set_test_cookie() and > request.session, but as far as I can see, they are not what I want. > > I want to save a named cookie, with a value, and specific domain and > path. Like PHP's setcookie(). I'm sure I'm just missing the obvious. Hey Matthew, Other people have pointed out the session framework, but if you just want to set arbitrary cookies you can use request.set_cookie(), documented here: http://www.djangoproject.com/documentation/request_response/#id1 Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How do you get and set cookies in django
Thanks limodou, that's just what I was looking for! -- mthorley --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How do you get and set cookies in django
On 9/8/06, mthorley <[EMAIL PROTECTED]> wrote: > > This may be a really dumb one, but I'm stooped. I read about > request.COOKIES, and request.session.set_test_cookie() and > request.session, but as far as I can see, they are not what I want. > > I want to save a named cookie, with a value, and specific domain and > path. Like PHP's setcookie(). I'm sure I'm just missing the obvious. > Here is the source code from dango session dealing, maybe helpful: expires = datetime.datetime.strftime(datetime.datetime.utcnow() + datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE), "%a, %d-%b-%Y %H:%M:%S GMT") response.set_cookie(settings.SESSION_COOKIE_NAME, session_key, max_age=settings.SESSION_COOKIE_AGE, expires=expires, domain=settings.SESSION_COOKIE_DOMAIN) some parameters you can replace with your values. -- I like python! My Blog: http://www.donews.net/limodou UliPad Site: http://wiki.woodpecker.org.cn/moin/UliPad UliPad Maillist: http://groups.google.com/group/ulipad --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How do you get and set cookies in django
This page should help. http://www.djangoproject.com/documentation/sessions/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---