Beispiel #1
0
    def register_preprocessor(cls, country, code):
        code = Code.fromstring(code)

        def decorator(func):
            cls.__preprocessors[country][code].append(func)

        return decorator
Beispiel #2
0
 def fromxml(cls, element):
     kwargs = {
         'required': False    
     }
     for child in element:
         value = child.text
         tag = child.tag
         if tag == 'elementId':
             kwargs['code'] = Code.fromstring(value)
         elif tag == 'elementDef':
             kwargs['name'] = value
         elif tag == 'fldJustify':
             kwargs['justify'] = value
         elif tag == 'posStart':
             kwargs['position'] = value
         elif tag == 'requiredIfSelected':
             kwargs['required'] = value == 'Y'
         elif tag == 'migrationPrecedence':
             kwargs['migration_precedence'] = value
         elif tag == 'elementDesc':
             # Description of the element. Currently not used.
             pass
         else:
             raise NotImplementedError("Unrecognized tag: " + tag)
     return cls(**kwargs)
Beispiel #3
0
 def parse_value(self, value):
     code, literal = [x.strip() for x in value.split(';')]
     self.code = Code.fromstring(code)
     self.literal = literal.strip('"')
Beispiel #4
0
 def register_preprocessor(cls, country, code):
     code = Code.fromstring(code)
     def decorator(func):
         cls.__preprocessors[country][code].append(func)
     return decorator
Beispiel #5
0
 def parse_value(self, value):
     code, literal = [x.strip() for x in value.split(';')]
     self.code = Code.fromstring(code)
     self.literal = literal.strip('"')