Permalink
Browse files

support for secure cookies (pulled from webpy.dev)

  • Loading branch information...
1 parent 44845e3 commit 7223775a2977a939f90a2d988efc02e61bb2cea9 @anandology anandology committed Dec 15, 2007
Showing with 3 additions and 1 deletion.
  1. +3 −1 web/webapi.py
View
@@ -123,13 +123,15 @@ def data():
ctx.data = ctx.env['wsgi.input'].read(cl)
return ctx.data
-def setcookie(name, value, expires="", domain=None):
+def setcookie(name, value, expires="", domain=None, secure=False):
"""Sets a cookie."""
if expires < 0:
expires = -1000000000
kargs = {'expires': expires, 'path':'/'}
if domain:
kargs['domain'] = domain
+ if secure:
+ kargs['secure'] = secure
# @@ should we limit cookies to a different path?
cookie = Cookie.SimpleCookie()
cookie[name] = value

0 comments on commit 7223775

Please sign in to comment.