[CalendarServer-changes] [1887]
CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.xattrprops
.patch
source_changes at macosforge.org
source_changes at macosforge.org
Thu Sep 20 13:22:48 PDT 2007
Revision: 1887
http://trac.macosforge.org/projects/calendarserver/changeset/1887
Author: wsanchez at apple.com
Date: 2007-09-20 13:22:47 -0700 (Thu, 20 Sep 2007)
Log Message:
-----------
Catch decompression exceptions when reading xattrs.
Existing data stores will not use compression, so if we get an error,
read the data without decompressing it. This is cheap, since the
exception is being raised anyway, so handling it is a no-brainer.
Modified Paths:
--------------
CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.xattrprops.patch
Modified: CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.xattrprops.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.xattrprops.patch 2007-09-20 19:18:56 UTC (rev 1886)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.xattrprops.patch 2007-09-20 20:22:47 UTC (rev 1887)
@@ -2,10 +2,11 @@
===================================================================
--- twisted/web2/dav/xattrprops.py (revision 19773)
+++ twisted/web2/dav/xattrprops.py (working copy)
-@@ -33,6 +33,10 @@
+@@ -33,6 +33,11 @@
import urllib
import sys
++import zlib
+from time import sleep
+from random import random
+from errno import EAGAIN
@@ -13,7 +14,7 @@
import xattr
-@@ -66,16 +70,8 @@
+@@ -66,16 +71,8 @@
deadPropertyXattrPrefix = "user."
def _encode(clazz, name):
@@ -32,12 +33,20 @@
return r
def _decode(clazz, name):
-@@ -97,19 +93,33 @@
+@@ -97,19 +94,41 @@
def get(self, qname):
try:
- value = self.attrs[self._encode(qname)]
-+ value = decompress(self.attrs[self._encode(qname)])
++ data = self.attrs[self._encode(qname)]
++ try:
++ value = 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
++ del data
except KeyError:
raise HTTPError(StatusResponse(
responsecode.NOT_FOUND,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070920/fc831fac/attachment.html
More information about the calendarserver-changes
mailing list