def handle(self, *args, **options): case_id = args[0] filename = args[1] case = BiharCase.get(case_id) with open(filename, 'w') as f: f.write(json.dumps(case.dump_json(), indent=2))
def _load_case(self, filename, format_dict=None): format_dict = format_dict or {} fullpath = os.path.join(os.path.dirname(__file__), 'data', 'cases', filename) with open(fullpath, 'r') as f: raw = f.read() formatted = raw % format_dict return BiharCase.from_dump(json.loads(formatted))
def handle(self, *args, **options): case_id = args[0] filename = args[1] case = BiharCase.get(case_id) with open(filename, "w") as f: f.write(json.dumps(case.dump_json(), indent=2))