[CalendarServer-changes] [3616] CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jan 28 00:01:18 PST 2009
Revision: 3616
http://trac.macosforge.org/projects/calendarserver/changeset/3616
Author: wsanchez at apple.com
Date: 2009-01-28 00:01:06 -0800 (Wed, 28 Jan 2009)
Log Message:
-----------
Ignore OD records with an invalid XML plist in the ResourceInfo attribute.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
Modified: CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py 2009-01-27 21:23:24 UTC (rev 3615)
+++ CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py 2009-01-28 08:01:06 UTC (rev 3616)
@@ -29,6 +29,8 @@
from twext.python.plistlib import readPlistFromString
+from xml.parsers.expat import ExpatError
+
import opendirectory
import dsattributes
import dsquery
@@ -189,35 +191,6 @@
return result
- def _parseResourceInfo(self, plist, guid, shortname):
- """
- Parse OD ResourceInfo attribute and extract information that the server needs.
-
- @param plist: the plist that is the attribute value.
- @type plist: str
- @param guid: the directory GUID of the record being parsed.
- @type guid: str
- @param shortname: the record shortname of the record being parsed.
- @type shortname: str
- @return: a C{tuple} of C{bool} for auto-accept, C{str} for proxy GUID, C{str} for read-only proxy GUID.
- """
- try:
- plist = readPlistFromString(plist)
- wpframework = plist.get("com.apple.WhitePagesFramework", {})
- autoaccept = wpframework.get("AutoAcceptsInvitation", False)
- proxy = wpframework.get("CalendaringDelegate", None)
- read_only_proxy = wpframework.get("ReadOnlyCalendaringDelegate", None)
- except AttributeError:
- self.log_error(
- "Failed to parse ResourceInfo attribute of record %s (%s): %s" %
- (shortname, guid, plist,)
- )
- autoaccept = False
- proxy = None
- read_only_proxy = None
-
- return (autoaccept, proxy, read_only_proxy,)
-
def recordTypes(self):
return (
DirectoryService.recordType_users,
@@ -554,7 +527,20 @@
if recordType in (DirectoryService.recordType_resources, DirectoryService.recordType_locations):
resourceInfo = value.get(dsattributes.kDSNAttrResourceInfo)
if resourceInfo is not None:
- autoSchedule, proxy, read_only_proxy = self._parseResourceInfo(resourceInfo, recordGUID, recordShortName)
+ try:
+ plist = readPlistFromString(resourceInfo)
+ except ExpatError, e:
+ self.log_error(
+ "Failed to parse ResourceInfo attribute of record (%s)%s (guid=%s, name=%s): %s\n%s" %
+ (recordType, recordShortName, recordGUID, recordFullName, e, resourceInfo)
+ )
+ continue
+
+ wpframework = plist.get("com.apple.WhitePagesFramework", {})
+ autoSchedule = wpframework.get("AutoAcceptsInvitation", False)
+ proxy = wpframework.get("CalendaringDelegate", None)
+ read_only_proxy = wpframework.get("ReadOnlyCalendaringDelegate", None)
+
if proxy:
proxyGUIDs = (proxy,)
if read_only_proxy:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090128/0a1f172f/attachment.html>
More information about the calendarserver-changes
mailing list