[CalendarServer-changes] [2575] CalendarServer/branches/users/cdaboo/sqlpropstore-2563/lib-patches/ Twisted/twisted.web2.dav.xattrprops.patch

source_changes at macosforge.org source_changes at macosforge.org
Tue Jun 17 12:43:02 PDT 2008


Revision: 2575
          http://trac.macosforge.org/projects/calendarserver/changeset/2575
Author:   cdaboo at apple.com
Date:     2008-06-17 12:43:02 -0700 (Tue, 17 Jun 2008)

Log Message:
-----------
Minor clean-up.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/sqlpropstore-2563/lib-patches/Twisted/twisted.web2.dav.xattrprops.patch

Modified: CalendarServer/branches/users/cdaboo/sqlpropstore-2563/lib-patches/Twisted/twisted.web2.dav.xattrprops.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/sqlpropstore-2563/lib-patches/Twisted/twisted.web2.dav.xattrprops.patch	2008-06-17 19:25:13 UTC (rev 2574)
+++ CalendarServer/branches/users/cdaboo/sqlpropstore-2563/lib-patches/Twisted/twisted.web2.dav.xattrprops.patch	2008-06-17 19:43:02 UTC (rev 2575)
@@ -11,7 +11,7 @@
 +from random import random
 +from errno import EAGAIN
 +from zlib import compress, decompress
-+from cPickle import loads as unpickle, PicklingError, UnpicklingError
++from cPickle import loads as unpickle, UnpicklingError
  
  import xattr
  
@@ -22,10 +22,11 @@
  from twisted.web2 import responsecode
  from twisted.web2.http import HTTPError, StatusResponse
  from twisted.web2.dav import davxml
-@@ -66,16 +73,8 @@
+@@ -65,21 +72,13 @@
+     if sys.platform == "linux2":
          deadPropertyXattrPrefix = "user."
  
-     def _encode(clazz, name):
+-    def _encode(clazz, name):
 -        #
 -        # FIXME: The xattr API in Mac OS 10.4.2 breaks if you have "/" in an
 -        # attribute name (radar://4202440). We'll quote the strings to get rid
@@ -36,11 +37,18 @@
 -            c = result[i]
 -            if c in "%/": result[i] = "%%%02X" % (ord(c),)
 -        r = clazz.deadPropertyXattrPrefix + ''.join(result)
++    def _encode(cls, name):
 +        result = urllib.quote("{%s}%s" % name, safe='{}:')
-+        r = clazz.deadPropertyXattrPrefix + result
++        r = cls.deadPropertyXattrPrefix + result
          return r
  
-     def _decode(clazz, name):
+-    def _decode(clazz, name):
+-        name = urllib.unquote(name[len(clazz.deadPropertyXattrPrefix):])
++    def _decode(cls, name):
++        name = urllib.unquote(name[len(cls.deadPropertyXattrPrefix):])
+ 
+         index = name.find("}")
+     
 @@ -97,19 +96,74 @@
  
      def get(self, qname):
@@ -131,11 +139,15 @@
      def contains(self, qname):
          try:
              return self._encode(qname) in self.attrs
-@@ -133,3 +191,7 @@
-         prefix_len = len(prefix)
+@@ -129,7 +187,8 @@
+             return False
  
-         return [ self._decode(name) for name in self.attrs if name.startswith(prefix) ]
-+
+     def list(self):
+-        prefix     = self.deadPropertyXattrPrefix
+-        prefix_len = len(prefix)
++        return [ self._decode(name) for name in self.attrs if name.startswith(self.deadPropertyXattrPrefix) ]
+ 
+-        return [ self._decode(name) for name in self.attrs if name.startswith(prefix) ]
 +    def copy(self, props):
 +        for item in props.list():
 +            self.set(props.get(item))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080617/1638f4ff/attachment.htm 


More information about the calendarserver-changes mailing list