[CalendarServer-changes] [1935]
CalendarServer/branches/release/CalendarServer-1.0-dev/twistedcaldav
/admin/util.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Oct 2 10:12:06 PDT 2007
Revision: 1935
http://trac.macosforge.org/projects/calendarserver/changeset/1935
Author: wsanchez at apple.com
Date: 2007-10-02 10:12:06 -0700 (Tue, 02 Oct 2007)
Log Message:
-----------
Pulled up r1930 r1932 from trunk.
Modified Paths:
--------------
CalendarServer/branches/release/CalendarServer-1.0-dev/twistedcaldav/admin/util.py
Modified: CalendarServer/branches/release/CalendarServer-1.0-dev/twistedcaldav/admin/util.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-1.0-dev/twistedcaldav/admin/util.py 2007-10-02 17:06:16 UTC (rev 1934)
+++ CalendarServer/branches/release/CalendarServer-1.0-dev/twistedcaldav/admin/util.py 2007-10-02 17:12:06 UTC (rev 1935)
@@ -17,6 +17,8 @@
##
import xattr
+import zlib
+from zlib import decompress
import commands
@@ -110,7 +112,7 @@
type = None
- dom = microdom.parseString(x[rt])
+ dom = microdom.parseString(_getxattr_value(x, rt))
rt = microdom.getElementsByTagName(dom, 'resourcetype')
for child in rt[0].childNodes:
@@ -179,7 +181,7 @@
if not x.has_key(quotaRoot):
return None
- dom = microdom.parseString(x[quotaRoot])
+ dom = microdom.parseString(_getxattr_value(x, quotaRoot))
qr = microdom.getElementsByTagName(dom, 'quota-root')[0]
@@ -191,7 +193,7 @@
if not x.has_key(quotaUsed):
return None
- dom = microdom.parseString(x[quotaUsed])
+ dom = microdom.parseString(_getxattr_value(x, quotaUsed))
qu = microdom.getElementsByTagName(dom, 'quota-used')[0]
@@ -222,3 +224,14 @@
'quotaUsed': prepareByteValue(config, principalUsed),
'quotaAvail': prepareByteValue(config, principalAvail),
'quotaFree': principalFree}
+
+def _getxattr_value(x, k):
+ data = x[k]
+ 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
+ return value
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20071002/3f6c9542/attachment.html
More information about the calendarserver-changes
mailing list