# HG changeset patch # User Daniele Nicolodi # Date 1313934406 -7200 # Node ID 18820d874f33c100162a0cc159f916cfcf24104e # Parent 8cf9fc08d43ddef03a9461ffcfb41ede1d53043b Cleanup some code that survied the makeovers. diff -r 8cf9fc08d43d -r 18820d874f33 src/ltpdarepo/database.py --- 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(';')]: diff -r 8cf9fc08d43d -r 18820d874f33 src/ltpdarepo/user.py --- 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: