bodhi/masher.py | 5 +++--
bodhi/model.py | 14 ++++++++++----
2 files changed, 13 insertions(+), 6 deletions(-)
New commits:
commit c238cbe1e0e1afde6dd949e35b91f12a00c1d58c
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Feb 19 22:49:48 2010 -0500
Don't use mutable keyword arguments.
This bug caused our masher to unnecessarily mash repos that it didn't need to,
and thus this fix will save us a lot of time.
diff --git a/bodhi/masher.py b/bodhi/masher.py
index 40a7356..5c0e178 100644
--- a/bodhi/masher.py
+++ b/bodhi/masher.py
@@ -73,7 +73,7 @@ class Masher(object):
self.last_log = None
@synchronized(lock)
- def queue(self, updates, repos=set(), resume=False):
+ def queue(self, updates, repos=None, resume=False):
self._queue.append((self.thread_id, updates, repos, resume))
self.thread_id += 1
if len(self._threads) == 0:
@@ -153,7 +153,7 @@ class Masher(object):
class MashTask(Thread):
- def __init__(self, id, updates, repos=set(), resume=False):
+ def __init__(self, id, updates, repos=None, resume=False):
""" Initialize a new MashTask thread.
@param updates: a list of PackageUpdate objects that we want to push
@@ -163,6 +163,7 @@ class MashTask(Thread):
is mash the repositories, close bugs, and send out update notices.
"""
Thread.__init__(self)
+ repos = repos and set(repos) or set()
log.debug("MashTask(%d, %s, %s, %s)" % (id, updates, repos, resume))
self.id = id
self.tag = None
commit 7edcb9c4b1c21144d08e727172c01048e534f69a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Feb 19 22:26:01 2010 -0500
Make PackageUpdate.comment work outside of a request (eg: during a push)
diff --git a/bodhi/model.py b/bodhi/model.py
index 14653dc..25145ea 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -25,6 +25,7 @@ from datetime import datetime
from turbogears import config
from turbogears.database import PackageHub
+from turbogears.identity import RequestRequiredException
from os.path import isfile, join
from textwrap import wrap
@@ -695,10 +696,15 @@ class PackageUpdate(SQLObject):
admin_groups = config.get('admin_groups',
'releng qa security_respons').split()
- for group in identity.current.groups:
- if group in admin_groups:
- author += ' (%s)' % group
- break
+ try:
+ for group in identity.current.groups:
+ if group in admin_groups:
+ author += ' (%s)' % group
+ break
+ except RequestRequiredException:
+ # This happens when we're adding comments from the masher,
+ # in which case this block is not necessary
+ pass
if not anonymous and karma != 0 and \
not filter(lambda c: c.author == author and c.karma == karma,