sobjects/parsers.py
branchstable
changeset 7700 0010dde5352a
parent 7689 a86fd3ec322e
child 7701 e5ba5de1d485
--- a/sobjects/parsers.py	Tue Jul 26 16:49:10 2011 +0200
+++ b/sobjects/parsers.py	Tue Jul 26 16:50:02 2011 +0200
@@ -75,7 +75,10 @@
             if rschema == 'eid':
                 continue
             attrtype = eschema.destination(rschema)
-            typeddict[rschema.type] = converters[attrtype](stringdict[rschema])
+            value = stringdict[rschema]
+            if value is not None:
+                value = converters[attrtype](value)
+            typeddict[rschema.type] = value
     return typeddict
 
 def rtype_role_rql(rtype, role):
@@ -294,9 +297,12 @@
                 # relation
                 related = rels.setdefault(role, {}).setdefault(child.tag, [])
                 related += [ritem for ritem, _ in self.parser.parse_etree(child)]
-            else:
+            elif child.text:
                 # attribute
                 item[child.tag] = unicode(child.text)
+            else:
+                # None attribute (empty tag)
+                item[child.tag] = None
         return item, rels