Show More
@@ -12,15 +12,16 def get_sqlite_conn_cur(): | |||||
12 | cur = conn.cursor() |
|
12 | cur = conn.cursor() | |
13 | return conn, cur |
|
13 | return conn, cur | |
14 |
|
14 | |||
15 | def check_for_db(): |
|
15 | def check_for_db(override): | |
16 | if os.path.isfile(os.path.join(ROOT, 'hg_app.db')): |
|
16 | if not override: | |
17 | raise Exception('database already exists') |
|
17 | if os.path.isfile(os.path.join(ROOT, 'hg_app.db')): | |
|
18 | raise Exception('database already exists') | |||
18 |
|
19 | |||
19 | def create_tables(): |
|
20 | def create_tables(override=False): | |
20 | """ |
|
21 | """ | |
21 | Create a auth database |
|
22 | Create a auth database | |
22 | """ |
|
23 | """ | |
23 | check_for_db() |
|
24 | check_for_db(override) | |
24 | conn, cur = get_sqlite_conn_cur() |
|
25 | conn, cur = get_sqlite_conn_cur() | |
25 | try: |
|
26 | try: | |
26 | logging.info('creating table %s', 'users') |
|
27 | logging.info('creating table %s', 'users') | |
@@ -65,7 +66,7 def create_user(username, password, admi | |||||
65 | raise |
|
66 | raise | |
66 |
|
67 | |||
67 | if __name__ == '__main__': |
|
68 | if __name__ == '__main__': | |
68 | create_tables() |
|
69 | create_tables(True) | |
69 | admin_prompt() |
|
70 | admin_prompt() | |
70 |
|
71 | |||
71 |
|
72 |
General Comments 0
You need to be logged in to leave comments.
Login now