def get_parser(template_name): """ Get the correct parser based on the file extension """ parser = XmlParser() # set the barcode file parser.barcode_library = find('common/pdf_img/barcode.ps') return parser
def get_parser(template_name): """ Get the correct parser based on the file extension """ import os if template_name[-4:] == '.xml': parser = XmlParser() # set the barcode file parser.barcode_library = find('common/pdf_img/barcode.ps') return parser else: return Parser()