[CalendarServer-changes] [10683] CalendarServer/trunk/twext/who/xml.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Feb 11 13:28:33 PST 2013


Revision: 10683
          http://trac.calendarserver.org//changeset/10683
Author:   wsanchez at apple.com
Date:     2013-02-11 13:28:33 -0800 (Mon, 11 Feb 2013)
Log Message:
-----------
Don't need UnknownFieldNameParseError... we want to ignore these fields, not the whole record.

Modified Paths:
--------------
    CalendarServer/trunk/twext/who/xml.py

Modified: CalendarServer/trunk/twext/who/xml.py
===================================================================
--- CalendarServer/trunk/twext/who/xml.py	2013-02-11 21:19:13 UTC (rev 10682)
+++ CalendarServer/trunk/twext/who/xml.py	2013-02-11 21:28:33 UTC (rev 10683)
@@ -62,13 +62,8 @@
     Unknown record type.
     """
 
-class UnknownFieldNameParseError(ParseError):
-    """
-    Unknown field name.
-    """
 
 
-
 ##
 # Data type extentions
 ##
@@ -270,8 +265,6 @@
                 records.add(self.parseRecordNode(recordNode))
             except UnknownRecordTypeParseError, e:
                 unknownRecordTypes.add(e.token)
-            except UnknownFieldNameParseError, e:
-                unknownFieldNames.add(e.token)
 
         #
         # Store results
@@ -307,7 +300,7 @@
         return etree
 
 
-    def parseRecordNode(self, recordNode):
+    def parseRecordNode(self, recordNode, unknownFieldNamesSet=None):
         recordTypeAttribute = recordNode.get(self.attribute.recordType.value, "").encode("utf-8")
         if recordTypeAttribute:
             try:
@@ -324,12 +317,14 @@
             try:
                 fieldElement = self.element.lookupByValue(fieldNode.tag)
             except ValueError:
-                raise UnknownFieldNameParseError(fieldNode.tag)
+                if unknownFieldNamesSet is not None:
+                    unknownFieldNamesSet.add(fieldNode.tag)
 
             try:
                 fieldName = fieldElement.fieldName
             except AttributeError:
-                raise UnknownFieldNameParseError(fieldNode.tag)
+                if unknownFieldNamesSet is not None:
+                    unknownFieldNamesSet.add(fieldNode.tag)
 
             value = fieldNode.text.encode("utf-8")
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130211/ba5ff79a/attachment-0001.html>


More information about the calendarserver-changes mailing list