コード例 #1
0
def cmd_import(input, settings):
    """
        todo import -i FILE
    """
    input = input or settings.input
    assert input, "Missing input file."
    sa = get_session(settings.dbref, metadata=SqlBase.metadata)
    json = js.load(open(input, 'r'))
    assert json['version'] == __version__, json['version']
    for t in json['tasks']:
        task = Task(**t)
        sa.add(task)
    sa.commit()
コード例 #2
0
def json_reader(file, ctx):
    return js.load(file)