Rev 61: Fix test suite under python2.4. in http://bazaar.launchpad.net/%7Ebzr/bzr.webdav/webdav

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Jul 3 16:52:20 BST 2008


At http://bazaar.launchpad.net/%7Ebzr/bzr.webdav/webdav

------------------------------------------------------------
revno: 61
revision-id: v.ladeuil+lp at free.fr-20080703155215-9xw0791rqkets403
parent: v.ladeuil+lp at free.fr-20080630155820-zsr9oipdcdg9fhks
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: webdav
timestamp: Thu 2008-07-03 17:52:15 +0200
message:
  Fix test suite under python2.4.
  
  * tests/dav_server.py:
  (TestingDAVRequestHandler.date_time_string): Copied from
  BaseHTTPServer.py since python 2.4 and 2.5 use different
  signatures.
modified:
  tests/dav_server.py            dav_server.py-20080609075311-lfywqma6p6uijow7-1
-------------- next part --------------
=== modified file 'tests/dav_server.py'
--- a/tests/dav_server.py	2008-06-09 14:24:25 +0000
+++ b/tests/dav_server.py	2008-07-03 15:52:15 +0000
@@ -27,6 +27,7 @@
 import re
 import shutil # FIXME: Can't we use bzrlib.osutils ?
 import stat
+import time
 import urlparse # FIXME: Can't we use bzrlib.urlutils ?
 
 
@@ -50,6 +51,17 @@
         r'bytes (?P<begin>\d+)-(?P<end>\d+)/(?P<size>\d+|\*)')
 
 
+    def date_time_string(self, timestamp=None):
+        """Return the current date and time formatted for a message header."""
+        if timestamp is None:
+            timestamp = time.time()
+        year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp)
+        s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
+                self.weekdayname[wd],
+                day, self.monthname[month], year,
+                hh, mm, ss)
+        return s
+
     def _read(self, length):
         """Read the client socket"""
         return self.rfile.read(length)



More information about the bazaar-commits mailing list