extras-buildsys/server User.py, 1.7.6.2, 1.7.6.3 UserInterface.py, 1.58.2.2.4.2, 1.58.2.2.4.3

Michael Schwendt mschwendt at fedoraproject.org
Thu Sep 4 20:45:24 UTC 2008


Author: mschwendt

Update of /cvs/fedora/extras-buildsys/server
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27566

Modified Files:
      Tag: Plague-0_4_5
	User.py UserInterface.py 
Log Message:
commit the fixes mentioned in changelog


Index: User.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/User.py,v
retrieving revision 1.7.6.2
retrieving revision 1.7.6.3
diff -u -r1.7.6.2 -r1.7.6.3
--- User.py	4 Sep 2008 02:14:20 -0000	1.7.6.2
+++ User.py	4 Sep 2008 20:45:23 -0000	1.7.6.3
@@ -20,6 +20,8 @@
     import pysqlite2._sqlite as sqlite
 
 import sys
+sys.path.append('/usr/share/plague/server')
+from DBManager import ResultSet
 
 CONFIG_LOCATION = "/etc/plague/server/"
 
@@ -84,6 +86,7 @@
         dbcx.commit()
         item = curs.fetchone()
         if item:
+            item = ResultSet(item, curs.description)
             user = User(email, False)
             user.own_jobs = item['own_jobs']
             user.job_admin = item['job_admin']


Index: UserInterface.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/UserInterface.py,v
retrieving revision 1.58.2.2.4.2
retrieving revision 1.58.2.2.4.3
diff -u -r1.58.2.2.4.2 -r1.58.2.2.4.3
--- UserInterface.py	31 Jan 2008 14:30:13 -0000	1.58.2.2.4.2
+++ UserInterface.py	4 Sep 2008 20:45:23 -0000	1.58.2.2.4.3
@@ -84,6 +84,12 @@
     return target_cfg
 
 
+def _fetchone(cursor,row):  # sqlite3 helper
+    if not row:
+        return None
+    return DBManager.ResultSet(row, cursor.description)
+
+
 class UserInterface:
     """
     Base UserInterface class. NO AUTHENTICATION.  Subclass this to provide some.
@@ -184,7 +190,7 @@
             del curs, dbcx
             return (-1, "Unable to access job database: '%s'" % e)
         curs.execute(sql)
-        job = dbcx.fetchone(curs)
+        job = _fetchone(curs,dbcx.fetchone(curs))
         result = None
         if not job:
             result = (-1, "Error: Invalid job UID.")
@@ -318,7 +324,7 @@
             del curs, dbcx
             return (-1, "Unable to access job database: '%s'" % e, [])
         curs.execute(sql)
-        data = dbcx.fetchall(curs)
+        data = [DBManager.ResultSet(row,curs.description) for row in curs.fetchall()]
         jobs = []
         for row in data:
             jobrec = {}
@@ -349,7 +355,7 @@
             sql = "SELECT jobid, parent_uid, starttime, endtime, arch, builder_addr, "  \
                     "status, builder_status FROM archjobs WHERE " + uids
             curs.execute(sql)
-            data = dbcx.fetchall(curs)
+            data = [DBManager.ResultSet(row,curs.description) for row in curs.fetchall()]
             for row in data:
                 ajrec = {}
                 ajrec['jobid'] = row['jobid']
@@ -386,7 +392,7 @@
         except StandardError, e:
             return (-1, "Unable to access job database: '%s'" % e, {})
         curs.execute(sql)
-        job = dbcx.fetchone(curs)
+        job = _fetchone(curs,dbcx.fetchone(curs))
         if not job:
             del curs, dbcx
             return (-1, "Error: Invalid job UID.", {})
@@ -420,7 +426,7 @@
         sql = "SELECT jobid, parent_uid, starttime, endtime, arch, builder_addr, "    \
                 "status, builder_status FROM archjobs WHERE parent_uid=%d " % uid
         curs.execute(sql)
-        data = dbcx.fetchall(curs)
+        data = [DBManager.ResultSet(row,curs.description) for row in curs.fetchall()]
         for row in data:
             ajrec = {}
             ajrec['jobid'] = row['jobid']
@@ -541,7 +547,7 @@
             return (-1, "Unable to access job database: '%s'" % e)
 
         curs.execute(sql)
-        job = dbcx.fetchone(curs)
+        job = _fetchone(curs,dbcx.fetchone(curs))
 
         result = None
         if not job:
@@ -630,7 +636,7 @@
             return (-1, "Unable to access job database: '%s'" % e)
 
         curs.execute(sql)
-        data = dbcx.fetchall(curs)
+        data = [DBManager.ResultSet(row,curs.description) for row in curs.fetchall()]
 
         # Ensure that the user can actually finish the jobs they requested
         final_uid_list = []




More information about the fedora-extras-commits mailing list