Example #1
0
 def parse_line(self, line):
     slinia = tuple(unicode(line.decode(self.encoding)).split(self.delimiter))
     slinia = map(lambda s: s.strip(), slinia)
     parsed = {'cchfact': {}, 'orig': line}
     data = build_dict(self.headers, slinia)
     result, errors = self.adapter.load(data)
     if errors:
         logger.error(errors)
     parsed['cchfact'] = result
     return parsed, errors
Example #2
0
 def parse_line(self, line):
     slinia = tuple(unicode(line.decode(self.encoding)).split(self.delimiter))
     slinia = map(lambda s: s.strip(), slinia)
     parsed = {'cchfact': {}, 'orig': line}
     data = build_dict(self.headers, slinia)
     result, errors = self.adapter.load(data)
     if errors:
         logger.error(errors)
     parsed['cchfact'] = result
     return parsed, errors
Example #3
0
def get_parser(cch_file):
    for path, cls in _PARSERS.items():
        if cls.detect(cch_file):
            return cls
    logger.error("Parser not found for file %s", cch_file)
    raise ParserNotFoundException()