cgi.py (cookie): Exclude attribute keys whose value is false.
[chopwood] / cgi.py
diff --git a/cgi.py b/cgi.py
index b06ef85..05c6c9e 100644 (file)
--- a/cgi.py
+++ b/cgi.py
@@ -145,7 +145,7 @@ def cookie(name, value, **kw):
                                  T.gmtime(U.NOW + maxage))
   return '; '.join(['%s=%s' % (urlencode(name), urlencode(value))] +
                    [v is not True and '%s=%s' % (k, v) or k
-                    for k, v in attr.iteritems()])
+                    for k, v in attr.iteritems() if v])
 
 def action(*v, **kw):
   """