import sys import json from src.articles.model import Article, FullArticleSchema from src.sections.model import Section,FullSectionSchema if len(sys.argv) <= 1: raise Error("Kein Zieldateiname angegeben") def dump_article(a): return FullArticleSchema().dump(a) def dump_section(s): return FullSectionSchema().dump(s) file = open(sys.argv[1], "w+") data={} data["articles"] = map(dump_article,Article.query.all()) data["sections"] = map(dump_section,Section.query.all()) json.dump (data, file) file.close()