Ejemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(
        prog='june',
        description='June: a forum',
    )
    parser.add_argument('command', nargs="*")
    parser.add_argument('-f', '--settings', dest='config')
    args = parser.parse_args()

    if args.config:
        parse_config_file(args.config)  # config
    else:
        return init_project()

    def run_command(cmd):
        if cmd == 'createdb':
            return create_db()
        if cmd == 'createuser':
            return create_superuser()
        if cmd == 'init':
            return init_project()

    if isinstance(args.command, basestring):
        return run_command(args.command)
    if isinstance(args.command, (list, tuple)):
        for cmd in args.command:
            run_command(cmd)
Ejemplo n.º 2
0
#!/usr/bin/python

from july.util import parse_config_file
parse_config_file('tmp.config')

from july.database import db
from june.topic.models import Topic, Vote


#: change name
def change_database():
    db.session.execute('alter table follownode rename to follow_node')
    db.session.execute('drop table memberlog')
    db.session.execute('drop table notify')
    db.session.commit()


# 1. change databse
#change_database()

# 2. make database


#: topic changes
def pre_update_topic_table():
    db.session.execute('alter table topic add column up_count integer')
    db.session.execute('alter table topic add column down_count integer')
    db.session.commit()


# 3. pre update topic table
Ejemplo n.º 3
0
#!/usr/bin/python

from july.util import parse_config_file
parse_config_file('tmp.config')

from july.database import db
from june.topic.models import Topic, Vote


#: change name
def change_database():
    db.session.execute('alter table follownode rename to follow_node')
    db.session.execute('drop table memberlog')
    db.session.execute('drop table notify')
    db.session.commit()

# 1. change databse
#change_database()

# 2. make database


#: topic changes
def pre_update_topic_table():
    db.session.execute('alter table topic add column up_count integer')
    db.session.execute('alter table topic add column down_count integer')
    db.session.commit()


# 3. pre update topic table
#pre_update_topic_table()