[CalendarServer-changes] [10669] CalendarServer/trunk/twext/who/xml.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Feb 8 16:53:05 PST 2013
Revision: 10669
http://trac.calendarserver.org//changeset/10669
Author: wsanchez at apple.com
Date: 2013-02-08 16:53:05 -0800 (Fri, 08 Feb 2013)
Log Message:
-----------
Start updateRecords.
Modified Paths:
--------------
CalendarServer/trunk/twext/who/xml.py
Modified: CalendarServer/trunk/twext/who/xml.py
===================================================================
--- CalendarServer/trunk/twext/who/xml.py 2013-02-08 19:00:08 UTC (rev 10668)
+++ CalendarServer/trunk/twext/who/xml.py 2013-02-09 00:53:05 UTC (rev 10669)
@@ -184,12 +184,21 @@
return self._index
- def loadRecords(self):
+ def loadRecords(self, loadNow=False):
+ """
+ Load records from L{self.filePath}.
+
+ Does nothing if a successful refresh has happened within the
+ last L{self.refreshInterval} seconds.
+
+ @param loadNow: Load now (ignore L{self.refreshInterval})
+ @type loadNow: boolean
+ """
#
# Punt if we've read the file recently
#
now = time()
- if now - self._lastRefresh < self.refreshInterval:
+ if not loadNow and now - self._lastRefresh <= self.refreshInterval:
return
#
@@ -302,7 +311,9 @@
self._cacheTag = cacheTag
self._lastRefresh = now
+ return etree
+
def flush(self):
self._realmName = None
self._unknownRecordTypes = None
@@ -355,6 +366,22 @@
return records
+ def updateRecords(self, records, create=False):
+ self.flush()
+ etree = self.loadRecords(loadNow=True)
+
+ directoryNode = etree.getroot()
+
+ for record in records:
+ for recordNode in directoryNode.getchildren():
+ raise NotImplementedError()
+
+ raise NotImplementedError()
+
+ raise NotImplementedError()
+
+
+
class DirectoryRecord(BaseDirectoryRecord):
"""
XML directory record
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130208/048d7087/attachment.html>
More information about the calendarserver-changes
mailing list