Commits

Anonymous committed c46b4f0

news for last commit

Comments (0)

Files changed (1)

webob/__init__.py

             value = '"%s"' % value.encode(self.charset)
         cookies = BaseCookie()
         cookies[key] = value
+        if isinstance(max_age, timedelta):
+            max_age = timedelta.seconds + timedelta.days*24*60*60
+        if max_age is not None:
+            future = datetime.utcnow() + timedelta(seconds=max_age)
+            expires = _serialize_date(future)
+        else:
+            expires = None
         for var_name, var_value in [
             ('max_age', max_age),
             ('path', path),
             ('HttpOnly', httponly),
             ('version', version),
             ('comment', comment),
+            ('expires', expires),
             ]:
             if var_value is not None and var_value is not False:
                 cookies[key][var_name.replace('_', '-')] = str(var_value)