[CalendarServer-changes] [11628] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 21 14:34:07 PDT 2013


Revision: 11628
          http://trac.calendarserver.org//changeset/11628
Author:   cdaboo at apple.com
Date:     2013-08-21 14:34:07 -0700 (Wed, 21 Aug 2013)
Log Message:
-----------
Fix issues with Last-Modified/getlastmodified header/property handling.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/resource.py
    CalendarServer/trunk/txdav/xml/base.py

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2013-08-21 21:27:38 UTC (rev 11627)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2013-08-21 21:34:07 UTC (rev 11628)
@@ -324,7 +324,7 @@
         @param transaction: optional transaction to use instead of associated transaction
         @type transaction: L{txdav.caldav.idav.ITransaction}
         """
-        result = yield super(CalDAVResource, self).renderHTTP(request)
+        response = yield super(CalDAVResource, self).renderHTTP(request)
         if transaction is None:
             transaction = self._associatedTransaction
         if transaction is not None:
@@ -332,9 +332,13 @@
                 yield transaction.abort()
             else:
                 yield transaction.commit()
-        returnValue(result)
 
+                # May need to reset the last-modified header in the response as txn.commit() can change it due to pre-commit hooks
+                if response.headers.hasHeader("last-modified"):
+                    response.headers.setHeader("last-modified", self.lastModified())
+        returnValue(response)
 
+
     # Begin transitional new-store resource interface:
 
     def copyDeadPropertiesTo(self, other):

Modified: CalendarServer/trunk/txdav/xml/base.py
===================================================================
--- CalendarServer/trunk/txdav/xml/base.py	2013-08-21 21:27:38 UTC (rev 11627)
+++ CalendarServer/trunk/txdav/xml/base.py	2013-08-21 21:34:07 UTC (rev 11628)
@@ -693,7 +693,7 @@
             return date.strftime("%a, %d %b %Y %H:%M:%S GMT")
 
         if type(date) is int:
-            date = format(datetime.datetime.fromtimestamp(date))
+            date = format(datetime.datetime.utcfromtimestamp(date))
         elif type(date) is str:
             pass
         elif type(date) is unicode:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130821/94621d1c/attachment.html>


More information about the calendarserver-changes mailing list