Anonymous avatar Anonymous committed d403306

o allow long timestamps to _serialize_data, which can happen on some platforms
(such as 64 bit stat results). long overflows generate ValueErrors anyway
o strip trailing semicolons in cookie headers to make Python 2.4 deployments
consistent with 2.5

Comments (0)

Files changed (1)


         dt = dt.timetuple()
     if isinstance(dt, (tuple, time.struct_time)):
         dt = calendar.timegm(dt)
-    if not isinstance(dt, (float, int)):
+    if not isinstance(dt, (float, int, long)):
         raise ValueError(
             "You must pass in a datetime, date, time tuple, or integer object, not %r" % dt)
     return formatdate(dt)
             if var_value is not None and var_value is not False:
                 cookies[key][var_name.replace('_', '-')] = str(var_value)
         header_value = cookies[key].output(header='').lstrip()
+        if header_value.endswith(';'):
+            # Python 2.4 adds a trailing ; to the end, strip it to be
+            # consistent with 2.5
+            header_value = header_value[:-1]
         self.headerlist.append(('Set-Cookie', header_value))
     def delete_cookie(self, key, path='/', domain=None):
                 del cookies[key]
                 header = cookies.output(header='').lstrip()
             if header:
+                if header.endswith(';'):
+                    # Python 2.4 adds a trailing ; to the end, strip it
+                    # to be consistent with 2.5
+                    header = header[:-1]
                 self.headers.add('Set-Cookie', header)
         if not found:
             raise KeyError(
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.