fedora-accounts bz-make-components-pkgdb.py,1.4,1.5

Toshio Ernie Kuratomi (toshio) fedora-extras-commits at redhat.com
Thu Aug 9 22:06:55 UTC 2007


Author: toshio

Update of /cvs/fedora/fedora-accounts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28566

Modified Files:
	bz-make-components-pkgdb.py 
Log Message:
- No longer need to get a database handle to the bzdb as we're entirely xmlrpc.
- Now able to check whether we need to process the cclist or not.  This will
  save us thousands of xmlrpc calls to bugzilla and a good deal of time.



Index: bz-make-components-pkgdb.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/bz-make-components-pkgdb.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- bz-make-components-pkgdb.py	9 Aug 2007 03:31:11 -0000	1.4
+++ bz-make-components-pkgdb.py	9 Aug 2007 22:06:53 -0000	1.5
@@ -44,11 +44,6 @@
 
         self.server = xmlrpclib.Server(bzServer)
 
-        # We still have to talk directly to the db for some things
-        self.bzdbh = website.get_dbh('bugs', BZDBHOST)
-        self.bzdbc = self.bzdbh.cursor()
-        self.bzdbh.commit()
-
         # Connect to the fedora account system
         self.fas = AccountSystem()
 
@@ -75,28 +70,6 @@
 
         return email
 
-    def _get_bugzilla_user_id(self, username):
-        bzdbc = self.bzdbh.cursor()
-        try:
-            user = self.userCache[username]
-        except KeyError:
-            self._get_bugzilla_email(username)
-            user = self.userCache[username]
-        
-        try:
-            bzid = user['bzid']
-        except KeyError:
-            bzdbc.execute("SELECT userid FROM profiles WHERE login_name = %s",
-                    (user['email'],))
-            if bzdbc.rowcount:
-                bzid = bzdbc.fetchone()[0]
-            else:
-                raise ValueError , 'Username %s with email %s does not have a bugzilla account.' % (username, user['email'])
-
-            user['bzid'] = bzid
-
-        return bzid
-
     def add_edit_component(self, package, collection, owner, description,
             qacontact=None, cclist=None):
         '''Add or update a component to have the values specified.
@@ -165,12 +138,14 @@
                     qacontact or product[pkgKey]['initialqacontact']):
                 data['initialqacontact'] = qacontact
 
-            ### FIXME: Currently no xmlrpc function to tell what the current
-            # cclist is so we end up having to set this for every package.
-            # When we can retrieve cclist via bugzilla.getProdCompDetails()
-            # we can make this more sensible.
-            data['initialcclist'] = initialCCList
-
+            if len(product[pkgKey]['initialcclist']) != len(initialCCList):
+                data['initialcclist'] = initialCCList
+            else:
+                for ccMember in product[pkgKey]['initialcclist']:
+                    if ccMember not in initialCCList:
+                        data['initialcclist'] = initialCCList
+                        break
+                    
             if data:
                 ### FIXME: initialowner has been made mandatory for some
                 # reason.  Asking dkl why.




More information about the fedora-extras-commits mailing list