summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2012-06-22 08:50:33 +0200
committerFlorian Bruhin <me@the-compiler.org>2012-06-22 08:51:02 +0200
commita507a05eeabf9e6375cf8716cdb6220aa4cb8911 (patch)
tree91bae4c3ae67a59964cf5674a6a59f7a024aaad3
parent21167c14b498df4f00e6eafc566b7db7411947f7 (diff)
downloadxdd2esi-a507a05eeabf9e6375cf8716cdb6220aa4cb8911.tar.gz
xdd2esi-a507a05eeabf9e6375cf8716cdb6220aa4cb8911.zip
Make _convert_datatypes() in xddlib a function, not a method
-rw-r--r--xddlib.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/xddlib.py b/xddlib.py
index 5581c20..740e23d 100644
--- a/xddlib.py
+++ b/xddlib.py
@@ -66,7 +66,7 @@ class XDDFile:
self._setobjects(tree) # Fill objlist
for obj in self._deepiterate():
# Convert datatype-numbers
- self._convert_datatypes(obj)
+ _convert_datatypes(obj)
# Convert numeric object types to datatype objects
_convert_objecttypes(obj)
# Cast strings to ints/...
@@ -118,24 +118,6 @@ class XDDFile:
_setattributes(subobject, child)
self.objlist.append(canobject)
- def _convert_datatypes(self, obj):
- """ Converts numeric XDD datatypes to datatype-objects """
- # toplevel-objects of subobjects don't have a dataType
- if obj.datatype is not None:
- py_datatype = _get_py_datatype(obj)
- obj.datatype = py_datatype
- special_handlers = {
- 'string': _set_string_length,
- 'octet': _set_octet_length,
- 'unicode': _set_string_length,
- }
- try:
- handler = special_handlers[py_datatype.type_]
- except KeyError:
- pass
- else:
- handler(obj)
-
def _convert_cast(self, obj):
""" Converts XML-strings to the right types """
# Available types:
@@ -344,4 +326,22 @@ def _convert_objecttypes(obj):
if obj.objecttype is not None:
obj.objecttype = objecttypes[obj.objecttype]
+def _convert_datatypes(obj):
+ """ Converts numeric XDD datatypes to datatype-objects """
+ # toplevel-objects of subobjects don't have a dataType
+ if obj.datatype is not None:
+ py_datatype = _get_py_datatype(obj)
+ obj.datatype = py_datatype
+ special_handlers = {
+ 'string': _set_string_length,
+ 'octet': _set_octet_length,
+ 'unicode': _set_string_length,
+ }
+ try:
+ handler = special_handlers[py_datatype.type_]
+ except KeyError:
+ pass
+ else:
+ handler(obj)
+