Пример #1
0
def main(args):
    if not args.narrative_ref:
        print(
            "Must include a Narrative object reference in the format XXX/YYY (these are the numbers in the usual Narrative URL)"
        )
        return 1

    if not args.outfile:
        print("Must include an output file for exporting the Narrative!")
        return 1

    outfile = args.outfile
    if not outfile.lower().endswith(".html"):
        outfile = outfile + ".html"

    exporter = NarrativeExporter()
    try:
        exporter.export_narrative(args.narrative_ref, outfile)
    except PermissionsError:
        print("The Narrative at reference " + args.narrative_ref +
              " does not appear to be public!")
        return 1
    except Exception as e:
        print("An error occurred while exporting your Narrative:")
        print(str(e))
        return 1
Пример #2
0
 def setUpClass(self, mock_io):
     mock_io.return_value.test_connection.return_value = ""
     mock_io.return_value.read_narrative = mock_read_narrative
     self.exporter = NarrativeExporter()