[CalendarServer-changes] [6899] CalendarServer/branches/users/glyph/linux-tests/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Mon Feb 7 04:39:40 PST 2011
Revision: 6899
http://trac.macosforge.org/projects/calendarserver/changeset/6899
Author: glyph at apple.com
Date: 2011-02-07 04:39:40 -0800 (Mon, 07 Feb 2011)
Log Message:
-----------
use xattr names everywhere.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/linux-tests/twistedcaldav/test/test_upgrade.py
CalendarServer/branches/users/glyph/linux-tests/twistedcaldav/upgrade.py
Modified: CalendarServer/branches/users/glyph/linux-tests/twistedcaldav/test/test_upgrade.py
===================================================================
--- CalendarServer/branches/users/glyph/linux-tests/twistedcaldav/test/test_upgrade.py 2011-02-07 12:39:28 UTC (rev 6898)
+++ CalendarServer/branches/users/glyph/linux-tests/twistedcaldav/test/test_upgrade.py 2011-02-07 12:39:40 UTC (rev 6899)
@@ -22,17 +22,27 @@
from twistedcaldav.directory.xmlfile import XMLDirectoryService
from twistedcaldav.directory.resourceinfo import ResourceInfoDatabase
from twistedcaldav.mail import MailGatewayTokensDatabase
-from twistedcaldav.upgrade import UpgradeError, upgradeData, updateFreeBusySet
+from twistedcaldav.upgrade import (
+ xattrname, UpgradeError, upgradeData, updateFreeBusySet
+)
from twistedcaldav.test.util import TestCase
from calendarserver.tools.util import getDirectory
import hashlib
import os, zlib, cPickle
-freeBusyAttr = "WebDAV:{urn:ietf:params:xml:ns:caldav}calendar-free-busy-set"
-cTagAttr = "WebDAV:{http:%2F%2Fcalendarserver.org%2Fns%2F}getctag"
-md5Attr = "WebDAV:{http:%2F%2Ftwistedmatrix.com%2Fxml_namespace%2Fdav%2F}getcontentmd5"
+
+freeBusyAttr = xattrname(
+ "{urn:ietf:params:xml:ns:caldav}calendar-free-busy-set"
+)
+cTagAttr = xattrname(
+ "{http:%2F%2Fcalendarserver.org%2Fns%2F}getctag"
+)
+md5Attr = xattrname(
+ "{http:%2F%2Ftwistedmatrix.com%2Fxml_namespace%2Fdav%2F}getcontentmd5"
+)
+
OLDPROXYFILE = ".db.calendaruserproxy"
NEWPROXYFILE = "proxies.sqlite"
@@ -852,7 +862,7 @@
},
"@xattrs" :
{
- "ignore" : "extra",
+ xattrname("ignore") : "extra",
cTagAttr : "12345",
},
},
@@ -908,7 +918,7 @@
},
"@xattrs" :
{
- "ignore" : "extra",
+ xattrname("ignore") : "extra",
cTagAttr : isValidCTag, # method below
},
},
@@ -972,7 +982,7 @@
},
"@xattrs" :
{
- "ignore" : "extra",
+ xattrname("ignore") : "extra",
cTagAttr : zlib.compress("<?xml version='1.0' encoding='UTF-8'?>\r\n<getctag xmlns='http://calendarserver.org/ns/'>2009-02-25 14:34:34.703093</getctag>\r\n"),
},
},
@@ -1028,7 +1038,7 @@
},
"@xattrs" :
{
- "ignore" : "extra",
+ xattrname("ignore") : "extra",
cTagAttr : zlib.compress("<?xml version='1.0' encoding='UTF-8'?>\r\n<getctag xmlns='http://calendarserver.org/ns/'>2009-02-25 14:34:34.703093</getctag>\r\n"),
},
},
Modified: CalendarServer/branches/users/glyph/linux-tests/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/branches/users/glyph/linux-tests/twistedcaldav/upgrade.py 2011-02-07 12:39:28 UTC (rev 6898)
+++ CalendarServer/branches/users/glyph/linux-tests/twistedcaldav/upgrade.py 2011-02-07 12:39:40 UTC (rev 6899)
@@ -39,9 +39,17 @@
from calendarserver.tools.util import getDirectory
from calendarserver.tools.resources import migrateResources
+from twisted.python.reflect import namedAny
+deadPropertyXattrPrefix = namedAny(
+ "txdav.base.propertystore.xattr.PropertyStore.deadPropertyXattrPrefix"
+)
+
log = Logger()
+def xattrname(n):
+ return deadPropertyXattrPrefix + n
+
def getCalendarServerIDs(config):
# Determine uid/gid for ownership of directories we create here
@@ -164,7 +172,7 @@
md5value = "<?xml version='1.0' encoding='UTF-8'?>\r\n<getcontentmd5 xmlns='http://twistedmatrix.com/xml_namespace/dav/'>%s</getcontentmd5>\r\n" % (hashlib.md5(data).hexdigest(),)
md5value = zlib.compress(md5value)
- xattr.setxattr(resPath, "WebDAV:{http:%2F%2Ftwistedmatrix.com%2Fxml_namespace%2Fdav%2F}getcontentmd5", md5value)
+ xattr.setxattr(resPath, xattrname("{http:%2F%2Ftwistedmatrix.com%2Fxml_namespace%2Fdav%2F}getcontentmd5"), md5value)
collectionUpdated = True
@@ -172,7 +180,7 @@
if collectionUpdated:
ctagValue = "<?xml version='1.0' encoding='UTF-8'?>\r\n<getctag xmlns='http://calendarserver.org/ns/'>%s</getctag>\r\n" % (str(datetime.datetime.now()),)
ctagValue = zlib.compress(ctagValue)
- xattr.setxattr(calPath, "WebDAV:{http:%2F%2Fcalendarserver.org%2Fns%2F}getctag", ctagValue)
+ xattr.setxattr(calPath, xattrname("{http:%2F%2Fcalendarserver.org%2Fns%2F}getctag"), ctagValue)
return errorOccurred
@@ -202,7 +210,7 @@
# __uids__/<guid> form
if cal == "inbox":
for attr, value in xattr.xattr(calPath).iteritems():
- if attr == "WebDAV:{urn:ietf:params:xml:ns:caldav}calendar-free-busy-set":
+ if attr == xattrname("{urn:ietf:params:xml:ns:caldav}calendar-free-busy-set"):
value = updateFreeBusySet(value, directory)
if value is not None:
# Need to write the xattr back to disk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110207/c85b597d/attachment.html>
More information about the calendarserver-changes
mailing list