Mercurial > getan
changeset 49:062ce001abd1
add backend method to create new projects
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 18 Mar 2011 14:43:24 +0100 |
parents | 5f87604ea5ed |
children | 9dbb6ee443a4 |
files | getan/backend.py |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/getan/backend.py Mon Feb 07 11:28:25 2011 +0100 +++ b/getan/backend.py Fri Mar 18 14:43:24 2011 +0100 @@ -74,6 +74,10 @@ VALUES(?,?,?,?) ''' +INSERT_PROJECT = ''' +INSERT INTO projects (id, key, description, active) VALUES (?,?,?,1) +''' + DELETE_PROJECT_ENTRY = 'DELETE FROM entries WHERE id = %i' MOVE_ENTRY = 'UPDATE entries SET project_id = ? WHERE id = ?' @@ -175,6 +179,15 @@ finally: close(cur) + def insert_project(self, project, key, description): + if project is None: + return + cur = None + try + cur = self.con.cursor() + cur.execute(INSERT_PROJECT, (project, key, description)) + self.con.commit() + logger.debug("Added a new project '%s' into db" % project) def delete_entries(self, entries): if entries is None: return