[CalendarServer-changes] [5698] CalendarServer/branches/new-store
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jun 7 14:18:46 PDT 2010
Revision: 5698
http://trac.macosforge.org/projects/calendarserver/changeset/5698
Author: glyph at apple.com
Date: 2010-06-07 14:18:44 -0700 (Mon, 07 Jun 2010)
Log Message:
-----------
Make the added tests pass.
Modified Paths:
--------------
CalendarServer/branches/new-store/txcaldav/calendarstore/file.py
CalendarServer/branches/new-store/txdav/propertystore/base.py
CalendarServer/branches/new-store/txdav/propertystore/xattr.py
Modified: CalendarServer/branches/new-store/txcaldav/calendarstore/file.py
===================================================================
--- CalendarServer/branches/new-store/txcaldav/calendarstore/file.py 2010-06-07 21:12:41 UTC (rev 5697)
+++ CalendarServer/branches/new-store/txcaldav/calendarstore/file.py 2010-06-07 21:18:44 UTC (rev 5698)
@@ -601,6 +601,17 @@
self._path.remove()
return undo
self._calendar._transaction.addOperation(do)
+ # Mark all properties as dirty, so they will be re-added to the
+ # temporary file when the main file is deleted. NOTE: if there were a
+ # temporary file and a rename() as there should be, this should really
+ # happen after the write but before the rename.
+ self.properties().update(self.properties())
+ # FIXME: the property store's flush() method may already have been
+ # added to the transaction, but we need to add it again to make sure it
+ # happens _after_ the new file has been written. we may end up doing
+ # the work multiple times, and external callers to property-
+ # manipulation methods won't work.
+ self._calendar._transaction.addOperation(self.properties().flush)
def component(self):
Modified: CalendarServer/branches/new-store/txdav/propertystore/base.py
===================================================================
--- CalendarServer/branches/new-store/txdav/propertystore/base.py 2010-06-07 21:12:41 UTC (rev 5697)
+++ CalendarServer/branches/new-store/txdav/propertystore/base.py 2010-06-07 21:18:44 UTC (rev 5698)
@@ -135,9 +135,6 @@
else:
return default
- def iter(self):
- return self.__iter__()
-
def iteritems(self):
return (
(key, self.get(key))
@@ -187,9 +184,12 @@
return default
- def update(other=None):
- # FIXME
- raise NotImplementedError()
+ def update(self, other):
+ # FIXME: direct tests.
+ # FIXME: support positional signature (although since strings aren't
+ # valid, it should just raise an error.
+ for key in other:
+ self[key] = other[key]
# FIXME: Actually, we should replace this with calls to IPropertyName()
Modified: CalendarServer/branches/new-store/txdav/propertystore/xattr.py
===================================================================
--- CalendarServer/branches/new-store/txdav/propertystore/xattr.py 2010-06-07 21:12:41 UTC (rev 5697)
+++ CalendarServer/branches/new-store/txdav/propertystore/xattr.py 2010-06-07 21:18:44 UTC (rev 5698)
@@ -185,7 +185,14 @@
def __iter__(self):
seen = set()
- for key in self.attrs:
+ try:
+ iterattr = iter(self.attrs)
+ except IOError, e:
+ if e.errno != errno.ENOENT:
+ raise
+ iterattr = iter(())
+
+ for key in iterattr:
key = self._decodeKey(key)
if key not in self.removed:
seen.add(key)
@@ -195,12 +202,9 @@
if key not in seen:
yield key
+
def __len__(self):
- keys = (
- set(self.attrs.keys()) |
- set(self._encodeKey(key) for key in self.modified)
- )
- return len(keys)
+ return len(self.keys())
#
# I/O
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100607/ecc338fe/attachment.html>
More information about the calendarserver-changes
mailing list