How to use the paperwork-backend.paperwork_backend.docimport.get_possible_importers function in paperwork-backend

To help you get started, we’ve selected a few paperwork-backend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openpaperwork / paperwork / paperwork-backend / paperwork_backend / shell.py View on Github external
def _get_importer(fileuris, doc):
    importers = docimport.get_possible_importers(fileuris, current_doc=doc)

    if len(importers) <= 0:
        raise Exception("Don't know how to import {}".format(fileuris))
    if len(importers) == 1:
        return importers[0]
    elif not is_interactive():
        raise Exception(
            "Many way to import {} and running in batch mode."
            " Can't import.\n{}"
            .format(
                fileuris,
                ", ".join([str(importer) for importer in importers])
            )
        )
    else:
        verbose("Import of {}:")