Ejemplo n.º 1
0
def cmd_list(settings):
    sa = Topic.get_session('default', settings.dbref)
    out = reporter.Reporter()
    assert out.get_context_path() == ('rst', 'paragraph')
    #out.start_list()
    #assert out.get_context_path() == ('rst', 'list')
    for t in Topic.all():
        reporter.stdout.Topic(t)
        #out.print_item(t)
    out.finish()
Ejemplo n.º 2
0
def cmd_new(NAME, REF, settings):
    #store = Topic.start_master_session()
    #print store
    #topic = store.Topic.byName(NAME)
    #if topic:
    #    pass
    #else:
    #    topic = store.Topic.forge(name=NAME)
    #    store.commit()
    #reporter.stdout.Topic(topic)

    # XXX: old
    sa = Topic.get_session('default', settings.dbref)
    topic = Topic.byName(NAME)
    if topic:
        log.std("Found existing topic %s, created %s", topic.name,
                topic.date_added)
    else:
        topic = Topic(name=NAME)
        topic.init_defaults()
        sa.add(topic)
        sa.commit()
        log.std("Added new topic %s", topic.name)
    reporter.stdout.Topic(topic)
Ejemplo n.º 3
0
def cmd_get(REF, settings):
    sa = Topic.get_session('default', settings.dbref)
    topic = Topic.byKey(dict(topic_id=REF))
    reporter.stdout.Topic(topic)
    topic = Topic.byName(REF)
    reporter.stdout.Topic(topic)