[profile gen] xselement_scheme_attribute is now public and return an attribute name
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 20 Jul 2016 17:00:39 +0200
changeset 1433 39dd81c65620
parent 1426 8c1a0a0310b8
child 1434 6fdbd3596d05
[profile gen] xselement_scheme_attribute is now public and return an attribute name instead of a pyxst attribute object. This is preparation work for a later cset.
entities/profile_generation.py
--- a/entities/profile_generation.py	Wed Jul 20 07:53:51 2016 +0200
+++ b/entities/profile_generation.py	Wed Jul 20 17:00:39 2016 +0200
@@ -405,12 +405,12 @@
 
     def concept_scheme_attribute(self, xselement, type_element, scheme):
         try:
-            xsattr = _xselement_scheme_attribute(xselement)
+            scheme_attr = xselement_scheme_attribute(xselement)
         except KeyError:
             print 'no scheme to be specified for', xselement
         else:
             self.element('xsd:attribute', type_element,
-                         attributes={'name': xsattr.local_name,
+                         attributes={'name': scheme_attr,
                                      'fixed': scheme.absolute_url()})
 
     def fill_organization_element(self, parent_element, value):
@@ -599,12 +599,12 @@
 
     def concept_scheme_attribute(self, xselement, type_element, scheme):
         try:
-            xsattr = _xselement_scheme_attribute(xselement)
+            scheme_attr = xselement_scheme_attribute(xselement)
         except KeyError:
             print 'no scheme to be specified for', xselement
         else:
             scheme_attr = self.element('rng:attribute', type_element,
-                                       attributes={'name': xsattr.local_name})
+                                       attributes={'name': scheme_attr})
             self.element('rng:value', scheme_attr, text=scheme.absolute_url())
 
     def fill_organization_element(self, parent_element, value):
@@ -764,8 +764,8 @@
     return rtype_targets
 
 
-def _xselement_scheme_attribute(xselement):
+def xselement_scheme_attribute(xselement):
     try:
-        return xselement.attributes['listSchemeURI'].target
+        return xselement.attributes['listSchemeURI'].target.local_name
     except KeyError:
-        return xselement.attributes['schemeURI'].target
+        return xselement.attributes['schemeURI'].target.local_name