[CalendarServer-changes] [3063] CalendarServer/trunk/twistedcaldav/directory

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 25 15:04:00 PDT 2008


Revision: 3063
          http://trac.macosforge.org/projects/calendarserver/changeset/3063
Author:   sagen at apple.com
Date:     2008-09-25 15:03:59 -0700 (Thu, 25 Sep 2008)
Log Message:
-----------
Tests assume that accounts.xml is always stat'ed

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/directory/test/test_xmlfile.py
    CalendarServer/trunk/twistedcaldav/directory/xmlfile.py

Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_xmlfile.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/test/test_xmlfile.py	2008-09-25 20:41:50 UTC (rev 3062)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_xmlfile.py	2008-09-25 22:03:59 UTC (rev 3063)
@@ -92,7 +92,7 @@
     Test XML file based directory implementation.
     """
     def service(self):
-        return XMLDirectoryService(self.xmlFile())
+        return XMLDirectoryService(self.xmlFile(), alwaysStat=True)
 
     def test_changedXML(self):
         service = self.service()

Modified: CalendarServer/trunk/twistedcaldav/directory/xmlfile.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/xmlfile.py	2008-09-25 20:41:50 UTC (rev 3062)
+++ CalendarServer/trunk/twistedcaldav/directory/xmlfile.py	2008-09-25 22:03:59 UTC (rev 3063)
@@ -42,7 +42,7 @@
     def __repr__(self):
         return "<%s %r: %r>" % (self.__class__.__name__, self.realmName, self.xmlFile)
 
-    def __init__(self, xmlFile):
+    def __init__(self, xmlFile, alwaysStat=False):
         super(XMLDirectoryService, self).__init__()
 
         if type(xmlFile) is str:
@@ -51,6 +51,7 @@
         self.xmlFile = xmlFile
         self._fileInfo = None
         self._lastCheck = 0
+        self._alwaysStat = alwaysStat
         self._accounts()
 
     def recordTypes(self):
@@ -92,7 +93,7 @@
 
     def _accounts(self):
         currentTime = time()
-        if currentTime - self._lastCheck > 60:
+        if self._alwaysStat or currentTime - self._lastCheck > 60:
             self.xmlFile.restat()
             self._lastCheck = currentTime
         fileInfo = (self.xmlFile.getmtime(), self.xmlFile.getsize())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080925/120b4412/attachment.html 


More information about the calendarserver-changes mailing list