changeset 79:18820d874f33

Cleanup some code that survied the makeovers.
author Daniele Nicolodi <daniele@grinta.net>
date Sun, 21 Aug 2011 15:46:46 +0200
parents 8cf9fc08d43d
children 06cf88d1e445
files src/ltpdarepo/database.py src/ltpdarepo/user.py
diffstat 2 files changed, 3 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/ltpdarepo/database.py	Sun Aug 21 14:41:20 2011 +0200
+++ b/src/ltpdarepo/database.py	Sun Aug 21 15:46:46 2011 +0200
@@ -43,13 +43,7 @@
         db = curs.fetchone()
         if db is None:
             return None
-        obj = Database()
-        for key, value in db.iteritems():
-            setattr(obj, key, value)
-        return obj
-
-    def update(self, vals=None, **kwargs):
-        kwargs.update(vals or {})
+        return Database(**db)
 
     def create(self):
         curs = g.db.cursor()
@@ -93,7 +87,7 @@
     # switch to the database we want to populate
     curs.execute("USE `%s`" % database)
     try:
-        # create tables        
+        # create tables
         pwd = os.path.dirname(__file__)
         sql = open(os.path.join(pwd, 'sql', 'database.sql'))
         for stmt in [x.strip() for x in sql.read().split(';')]:
--- a/src/ltpdarepo/user.py	Sun Aug 21 14:41:20 2011 +0200
+++ b/src/ltpdarepo/user.py	Sun Aug 21 15:46:46 2011 +0200
@@ -72,10 +72,7 @@
         user = curs.fetchone()
         if user is None:
             return None
-        obj = User()
-        for key, value in user.iteritems():
-            setattr(obj, key, value)
-        return obj
+        return User(**user)
 
     def create(self):
         if not self.password: