Add a set defining all rule types in xsd2yams
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 14 Oct 2016 11:17:35 +0200
changeset 1738 508d1fb489a7
parent 1737 8d1f91ac86d1
child 1739 e0d4e2917137
Add a set defining all rule types in xsd2yams for later sharing
entities/__init__.py
xsd2yams.py
--- a/entities/__init__.py	Wed Oct 12 10:57:57 2016 +0200
+++ b/entities/__init__.py	Fri Oct 14 11:17:35 2016 +0200
@@ -23,6 +23,7 @@
 
 from cubes.seda import seda_profile_container_def
 from cubes.seda.xsd import XSDMMapping
+from cubes.seda.xsd2yams import RULE_TYPES
 
 
 XSDM_MAPPING = XSDMMapping('ArchiveTransfer')
@@ -109,9 +110,7 @@
     else:
         rule_type = etype[len('SEDA'):-len('Rule')]
     rule_type = rule_type.lower()
-    assert rule_type in ('access', 'appraisal', 'classification',
-                         'reuse', 'dissemination', 'storage'), \
-        'unhandled etype {}'.format(etype)
+    assert rule_type in RULE_TYPES, 'unhandled etype {0}'.format(etype)
     return rule_type
 
 
--- a/xsd2yams.py	Wed Oct 12 10:57:57 2016 +0200
+++ b/xsd2yams.py	Fri Oct 14 11:17:35 2016 +0200
@@ -27,6 +27,8 @@
 
 
 EXT_ETYPES = set(['Agent', 'ConceptScheme', 'Concept'])
+RULE_TYPES = set(('access', 'appraisal', 'classification', 'reuse', 'dissemination', 'storage'))
+
 # elements in the intermediary model but not in the yams model
 SKIP_ETYPES = set(['SEDAid', 'SEDAhref', 'SEDAfilename'])
 SKIP_ATTRS = set([