More resilient, just translated OSGI XSDs and they where 'inventive' in some regards
This commit is contained in:
@@ -187,8 +187,11 @@ class PyObj(object):
|
|||||||
cname = cdict[sup].class_name
|
cname = cdict[sup].class_name
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
(namespace,tag) = cdict[sup].name.split('.')
|
(namespace,tag) = cdict[sup].name.split('.')
|
||||||
|
if namespace:
|
||||||
ctag = self.root.modul[namespace].factory(tag).__class__.__name__
|
ctag = self.root.modul[namespace].factory(tag).__class__.__name__
|
||||||
cname = '%s.%s' % (namespace,ctag)
|
cname = '%s.%s' % (namespace,ctag)
|
||||||
|
else:
|
||||||
|
cname = tag + "_"
|
||||||
return cname
|
return cname
|
||||||
|
|
||||||
def class_definition(self, target_namespace, cdict=None, ignore=None):
|
def class_definition(self, target_namespace, cdict=None, ignore=None):
|
||||||
@@ -210,8 +213,12 @@ class PyObj(object):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
cname = cdict[sup].name
|
cname = cdict[sup].name
|
||||||
(namespace, tag) = cname.split('.')
|
(namespace, tag) = cname.split('.')
|
||||||
ctag = self.root.modul[namespace].factory(tag).__class__.__name__
|
if namespace:
|
||||||
|
ctag = self.root.modul[namespace].factory(
|
||||||
|
tag).__class__.__name__
|
||||||
cname = '%s.%s' % (namespace, ctag)
|
cname = '%s.%s' % (namespace, ctag)
|
||||||
|
else:
|
||||||
|
cname = tag + "_"
|
||||||
klass = self.knamn(sup, cdict)
|
klass = self.knamn(sup, cdict)
|
||||||
sups.append(klass)
|
sups.append(klass)
|
||||||
|
|
||||||
@@ -581,8 +588,9 @@ class PyType(PyObj):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
(mod, typ) = sup.split('.')
|
(mod, typ) = sup.split('.')
|
||||||
supc = pyobj_factory(sup, None, None)
|
supc = pyobj_factory(sup, None, None)
|
||||||
supc.properties = [_import_attrs(self.root.modul[mod], typ,
|
if mod:
|
||||||
self.root),[]]
|
supc.properties = [_import_attrs(self.root.modul[mod],
|
||||||
|
typ, self.root),[]]
|
||||||
cdict[sup] = supc
|
cdict[sup] = supc
|
||||||
supc.done = True
|
supc.done = True
|
||||||
|
|
||||||
@@ -1281,7 +1289,13 @@ class ComplexType(Complex):
|
|||||||
if len(cci.parts) == 1:
|
if len(cci.parts) == 1:
|
||||||
if isinstance(cci.parts[0], Extension):
|
if isinstance(cci.parts[0], Extension):
|
||||||
ext = cci.parts[0]
|
ext = cci.parts[0]
|
||||||
|
|
||||||
|
try:
|
||||||
(namespace, name) = ext.base.split(":")
|
(namespace, name) = ext.base.split(":")
|
||||||
|
except ValueError:
|
||||||
|
name = ext.base
|
||||||
|
namespace = ""
|
||||||
|
|
||||||
if namespace and \
|
if namespace and \
|
||||||
ext.xmlns_map[namespace] == top.target_namespace:
|
ext.xmlns_map[namespace] == top.target_namespace:
|
||||||
new_sup = name
|
new_sup = name
|
||||||
@@ -1426,6 +1440,8 @@ def pyify_0(name):
|
|||||||
res += "_"+match.group(num+1).lower()+match.group(num)[1:]
|
res += "_"+match.group(num+1).lower()+match.group(num)[1:]
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
res = res.replace("-","_")
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def pyify(name):
|
def pyify(name):
|
||||||
@@ -1437,6 +1453,8 @@ def pyify(name):
|
|||||||
for char in name:
|
for char in name:
|
||||||
if char >= "A" and char <= "Z":
|
if char >= "A" and char <= "Z":
|
||||||
upc.append(char)
|
upc.append(char)
|
||||||
|
elif char == "-":
|
||||||
|
upc.append("_")
|
||||||
else:
|
else:
|
||||||
if upc:
|
if upc:
|
||||||
if len(upc) == 1:
|
if len(upc) == 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user