# HG changeset patch # User Marcin Kuzminski # Date 2010-04-19 20:52:31 # Node ID 911dab498eb22284b15975c3147a6009f3e9c574 # Parent 9f6300b96380e97593df69cd7806bbc1d3847cbb Updated db manage diff --git a/pylons_app/lib/db_manage.py b/pylons_app/lib/db_manage.py --- a/pylons_app/lib/db_manage.py +++ b/pylons_app/lib/db_manage.py @@ -12,15 +12,16 @@ def get_sqlite_conn_cur(): cur = conn.cursor() return conn, cur -def check_for_db(): - if os.path.isfile(os.path.join(ROOT, 'hg_app.db')): - raise Exception('database already exists') +def check_for_db(override): + if not override: + if os.path.isfile(os.path.join(ROOT, 'hg_app.db')): + raise Exception('database already exists') -def create_tables(): +def create_tables(override=False): """ Create a auth database """ - check_for_db() + check_for_db(override) conn, cur = get_sqlite_conn_cur() try: logging.info('creating table %s', 'users') @@ -65,7 +66,7 @@ def create_user(username, password, admi raise if __name__ == '__main__': - create_tables() + create_tables(True) admin_prompt()