Revision
1586
Author
dreid@apple.com
Date
2007-06-06 08:20:06 -0700 (Wed, 06 Jun 2007)

Log Message

Make xmlfile restat the file before checking the mtime and size.

Make test_changedXML use a single service instance, instead of a new one for each item in the loop.

Modified Paths

Diff

Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_xmlfile.py (1585 => 1586)


--- CalendarServer/trunk/twistedcaldav/directory/test/test_xmlfile.py	2007-06-05 18:37:22 UTC (rev 1585)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_xmlfile.py	2007-06-06 15:20:06 UTC (rev 1586)
@@ -89,6 +89,8 @@
         return XMLDirectoryService(self.xmlFile())
 
     def test_changedXML(self):
+        service = self.service()
+
         self.xmlFile().open("w").write(
 """<?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE accounts SYSTEM "accounts.dtd">
@@ -108,6 +110,6 @@
             ( DirectoryService.recordType_resources , ()         ),
         ):
             self.assertEquals(
-                set(r.shortName for r in self.service().listRecords(recordType)),
+                set(r.shortName for r in service.listRecords(recordType)),
                 set(expectedRecords)
             )

Modified: CalendarServer/trunk/twistedcaldav/directory/xmlfile.py (1585 => 1586)


--- CalendarServer/trunk/twistedcaldav/directory/xmlfile.py	2007-06-05 18:37:22 UTC (rev 1585)
+++ CalendarServer/trunk/twistedcaldav/directory/xmlfile.py	2007-06-06 15:20:06 UTC (rev 1586)
@@ -87,6 +87,7 @@
              yield entry.shortName, entry
 
     def _accounts(self):
+#        self.xmlFile.restat()
         fileInfo = (self.xmlFile.getmtime(), self.xmlFile.getsize())
         if fileInfo != self._fileInfo:
             parser = XMLAccountsParser(self.xmlFile)