[profile gen] Reformulate using if expr
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 10 Jan 2017 16:06:17 +0100
changeset 2259 c53a0d875814
parent 2258 9ee61b23011c
child 2260 88b2dff556c3
[profile gen] Reformulate using if expr
entities/profile_generation.py
--- a/entities/profile_generation.py	Fri Jan 06 14:08:07 2017 +0100
+++ b/entities/profile_generation.py	Tue Jan 10 16:06:17 2017 +0100
@@ -436,10 +436,8 @@
         target_element = self.element('xsd:attribute', parent, attrs)
         value = serialize(target_value)
         if value is not None:
-            if xselement.local_name == 'id':
-                target_element.attrib[self.qname('seda:profid')] = value
-            else:
-                target_element.attrib['fixed'] = value
+            attr = self.qname('seda:profid') if xselement.local_name == 'id' else 'fixed'
+            target_element.attrib[attr] = value
 
     def element_xmlelement(self, occ, profile_element, target_value, to_process, card_entity):  # noqa
         attrs = xsd_element_cardinality(occ, card_entity)