diff --git a/requirements.txt b/requirements.txt index dae2994..5ddcb01 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ WebOb==1.2.3 alembic==0.4.2 argparse==1.2.1 cryptacular==1.4.1 -fixture==1.6 +fixture==1.5 flake8==2.0 ipython==0.13.1 mccabe==0.2 diff --git a/update.py b/update.py index 3aa22bd..ed59845 100644 --- a/update.py +++ b/update.py @@ -49,7 +49,7 @@ def copytree(src, dst, symlinks = False, ignore = None): if not os.path.exists(pathMap): copytree(pathOldMap, pathMap) else: - raise "The directory "+pathMap+" already exists" + raise Exception("The directory "+pathMap+" already exists") cur.execute('select * from groups where map_id=? order by group_index',(m['map_id'],)) groups = cur.fetchall() @@ -66,18 +66,18 @@ def copytree(src, dst, symlinks = False, ignore = None): f.write(" "+str(i+1)+": "+groups[i]['group_name']+" \n") f.write("}") #delete groups from database - cur2.execute("select * from workspaces where name=?",(m['ws_name'],)) - ws = cur2.fetchone() - if not ws: - print("Adding workspace to the database...") - cur2.execute("insert into workspaces(name) values(?)",(m['ws_name'],)) - ws_id = cur2.lastrowid - else: - ws_id = ws['id'] - - print("Adding map to the database...") - cur2.execute("insert into maps(name, workspace_id, type) values(?, ?, ?)",(m['map_name'], ws_id, m['map_type'],)) - con2.commit() + cur2.execute("select * from workspaces where name=?",(m['ws_name'],)) + ws = cur2.fetchone() + if not ws: + print("Adding workspace to the database...") + cur2.execute("insert into workspaces(name) values(?)",(m['ws_name'],)) + ws_id = cur2.lastrowid + else: + ws_id = ws['id'] + + print("Adding map to the database...") + cur2.execute("insert into maps(name, workspace_id, type) values(?, ?, ?)",(m['map_name'], ws_id, m['map_type'],)) + con2.commit() if con: con.close()