[profile gen] Some code cleanup
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 20 Jul 2016 11:40:22 +0200
changeset 1434 6fdbd3596d05
parent 1433 39dd81c65620
child 1435 7081d6248f81
[profile gen] Some code cleanup Remove print and drop XXX in favor of explanation.
entities/profile_generation.py
--- a/entities/profile_generation.py	Wed Jul 20 17:00:39 2016 +0200
+++ b/entities/profile_generation.py	Wed Jul 20 11:40:22 2016 +0200
@@ -207,7 +207,8 @@
                 try:
                     etype, child_defs = XSDM_MAPPING[xselement]
                 except KeyError:
-                    continue  # XXX explain or fix me
+                    # element has no children
+                    continue
                 for entity, profile_element in entities_profiles:
                     assert etype == entity.cw_etype
                     self._process(entity, profile_element, child_defs, to_process)
@@ -407,11 +408,10 @@
         try:
             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': scheme_attr,
-                                     'fixed': scheme.absolute_url()})
+            return
+        self.element('xsd:attribute', type_element,
+                     attributes={'name': scheme_attr,
+                                 'fixed': scheme.absolute_url()})
 
     def fill_organization_element(self, parent_element, value):
         target_element = self.element('xsd:element', parent_element, {'name': 'Identifier'})
@@ -601,11 +601,10 @@
         try:
             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': scheme_attr})
-            self.element('rng:value', scheme_attr, text=scheme.absolute_url())
+            return
+        scheme_attr = self.element('rng:attribute', type_element,
+                                   attributes={'name': scheme_attr})
+        self.element('rng:value', scheme_attr, text=scheme.absolute_url())
 
     def fill_organization_element(self, parent_element, value):
         target_element = self.element('rng:element', parent_element, {'name': 'Identifier'})