[CalendarServer-changes] [2331] CalendarServer/trunk/twistedcaldav/admin

source_changes at macosforge.org source_changes at macosforge.org
Mon Apr 21 12:39:18 PDT 2008


Revision: 2331
          http://trac.macosforge.org/projects/calendarserver/changeset/2331
Author:   cdaboo at apple.com
Date:     2008-04-21 12:39:18 -0700 (Mon, 21 Apr 2008)

Log Message:
-----------
Update caladmin for __uids__ use with /calendars/, and for pickled xattrs.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/admin/principals.py
    CalendarServer/trunk/twistedcaldav/admin/util.py

Modified: CalendarServer/trunk/twistedcaldav/admin/principals.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/admin/principals.py	2008-04-21 17:49:43 UTC (rev 2330)
+++ CalendarServer/trunk/twistedcaldav/admin/principals.py	2008-04-21 19:39:18 UTC (rev 2331)
@@ -61,7 +61,7 @@
                 precord = {}
                 
                 pcal = self.calendarCollection.child(
-                    self.type
+                    "__uids__"
                     ).child(util.getPrincipalName(p))
             
                 precord['principalName'] = util.getPrincipalName(p)

Modified: CalendarServer/trunk/twistedcaldav/admin/util.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/admin/util.py	2008-04-21 17:49:43 UTC (rev 2330)
+++ CalendarServer/trunk/twistedcaldav/admin/util.py	2008-04-21 19:39:18 UTC (rev 2331)
@@ -17,6 +17,8 @@
 import xattr
 import zlib
 from zlib import decompress
+from cPickle import loads as unpickle, UnpicklingError
+import os
 
 import commands
 
@@ -66,7 +68,9 @@
 
     if typeRoot.exists():
         for child in typeRoot.listdir():
-            if not child.startswith(db_prefix):
+            if (not child.startswith(db_prefix) and
+                not child.endswith("#calendar-proxy-write") and
+                not child.endswith("#calendar-proxy-read")):
                 p = typeRoot.child(child)
                 ptype = getPrincipalType(p)
                 if ptype == type:
@@ -101,16 +105,8 @@
     return rtp[0].firstChild().value
     
 def getPrincipalName(fp):
-    rtp = "WebDAV:" + RecordNameProperty.sname().replace("/", "%2F")
-    x = xattr.xattr(fp.path)
-    if not x.has_key(rtp):
-        return None
+    return os.path.basename(fp.path)
 
-    dom = microdom.parseString(_getxattr_value(x, rtp))
-    rtp = microdom.getElementsByTagName(dom, 'record-name')
-
-    return rtp[0].firstChild().value
-    
 def getResourceType(fp):
     rt = 'WebDAV:{DAV:}resourcetype'
     x = xattr.xattr(fp.path)
@@ -237,10 +233,14 @@
 def _getxattr_value(x, k):
     data = x[k]
     try:
-        value = decompress(data)
+        try:
+            return unpickle(decompress(data)).toxml()
+        except UnpicklingError:
+            pass
+        return decompress(data)
     except zlib.error:
         # Value is not compressed; data was stored by old
         # code.  This is easy to handle, so let's keep
         # compatibility here.
-        value = data
-    return value
+        pass
+    return data

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080421/29628b33/attachment.html


More information about the calendarserver-changes mailing list