Example #1
0
def cmd_init(settings):
    sa = Host.get_session("default", settings.dbref)
    host_dict = init_host(settings)
    name = host_dict["name"]
    record = Host.fetch(filters=(Host.name == name,), sa=sa, exists=False)
    if not record:
        host = Host(name=name, date_added=datetime.now(), date_updated=datetime.now())
        sa.add(host)
        sa.commit()
        log.std("{bwhite}Added host %s record{default}", name)
    else:
        host = record
    print "host at", host_dict.path(), ":", host
Example #2
0
def cmd_test_init(settings):
    sa = Host.get_session("default", settings.dbref)
    host_dict = init_host(settings)
    name = host_dict["name"]
    print Host.fetch(filters=(Host.name == name,), sa=sa, exists=False)
Example #3
0
def cmd_list(settings):
    sa = Host.get_session("default", settings.dbref)
    for h in sa.query(Host).all():
        print h