bodhi/bodhi/model/model.py | 11 +++++------
bodhi/bodhi/tests/models/test_model.py | 22 +++++++++++-----------
bodhi/development.ini | 3 ++-
3 files changed, 18 insertions(+), 18 deletions(-)
New commits:
commit 76186e9fc3bf3924db362597fd701b40bc7e2592
Author: Mathieu Bridon <bochecha(a)fedoraproject.org>
Date: Fri Feb 19 00:18:57 2010 +0100
Remove the hardcoded Bugzilla URL from the model, this should be a configuration.
diff --git a/bodhi/bodhi/model/model.py b/bodhi/bodhi/model/model.py
index ca1118c..1041691 100644
--- a/bodhi/bodhi/model/model.py
+++ b/bodhi/bodhi/model/model.py
@@ -905,9 +905,8 @@ class Bug(DeclarativeBase):
except xmlrpclib.Fault, f:
log.error("Unable to close bug #%d: %s" % (self.bug_id, str(f)))
-# TODO: remove this
def get_url(self):
- return "https://bugzilla.redhat.com/show_bug.cgi?id=%s" % self.bug_id
+ return "%s/show_bug.cgi?id=%s" % (config.get('bz_baseurl'),
self.bug_id)
# TODO; put this somewhere else!
diff --git a/bodhi/development.ini b/bodhi/development.ini
index 8855b2a..dac7f54 100644
--- a/bodhi/development.ini
+++ b/bodhi/development.ini
@@ -209,7 +209,8 @@ pkgdb_url =
https://admin.fedoraproject.org/pkgdb
## Bugzilla settings. The username/password for our bugzilla account comes
## from the bodhi_{email,password} fields.
##
-bz_server =
https://bugzilla.redhat.com/xmlrpc.cgi
+bz_baseurl =
https://bugzilla.redhat.com
+bz_server = %(bz_baseurl)s/xmlrpc.cgi
bz_cookie = None
##
commit 4a300ead149909f05a8eb4b578e1fd619dd817c7
Author: Mathieu Bridon <bochecha(a)fedoraproject.org>
Date: Thu Feb 18 22:51:06 2010 +0100
Update alias modifications.
The update alias was made unique, to avoid any issue like what just happened in
production.
Also, the assign_id method was renamed to assign_alias, as that's what it
actually does.
diff --git a/bodhi/bodhi/model/model.py b/bodhi/bodhi/model/model.py
index b89ffdd..ca1118c 100644
--- a/bodhi/bodhi/model/model.py
+++ b/bodhi/bodhi/model/model.py
@@ -231,7 +231,7 @@ class Update(DeclarativeBase):
releng_approval_date = Column(DateTime)
# eg: FEDORA-EPEL-2009-12345
- alias = Column(Unicode(32), default=None)
+ alias = Column(Unicode(32), default=None, unique=True)
# One-to-one relationships
release_id = Column(Integer, ForeignKey('releases.id'))
@@ -289,7 +289,7 @@ class Update(DeclarativeBase):
""" Return a space-delimited string of CVE ids for this update
"""
return u' '.join([cve.cve_id for cve in self.cves])
- def assign_id(self):
+ def assign_alias(self):
"""Assign an update ID to this update.
This function finds the next number in the sequence of pushed updates
@@ -405,7 +405,7 @@ class Update(DeclarativeBase):
self.pushed = True
self.date_pushed = datetime.utcnow()
self.status = u'testing'
- self.assign_id()
+ self.assign_alias()
elif self.request == u'obsolete':
self.pushed = False
self.status = u'obsolete'
@@ -413,7 +413,7 @@ class Update(DeclarativeBase):
self.pushed = True
self.date_pushed = datetime.utcnow()
self.status = u'stable'
- self.assign_id()
+ self.assign_alias()
self.request = None
def modify_bugs(self):
diff --git a/bodhi/bodhi/tests/models/test_model.py
b/bodhi/bodhi/tests/models/test_model.py
index 1a0476f..9a760f3 100644
--- a/bodhi/bodhi/tests/models/test_model.py
+++ b/bodhi/bodhi/tests/models/test_model.py
@@ -152,15 +152,15 @@ class TestUpdate(ModelTest):
def test_cvestring(self):
eq_(self.obj.get_cvestring(), u'CVE-2009-0001')
- def test_assign_id(self):
+ def test_assign_alias(self):
update = self.obj
- update.assign_id()
+ update.assign_alias()
eq_(update.alias, u'%s-%s-0001' % (update.release.id_prefix,
time.localtime()[0]))
#assert update.date_pushed
update = self.get_update(name=u'TurboGears-0.4.4-8.fc11')
- update.assign_id()
+ update.assign_alias()
eq_(update.alias, u'%s-%s-0002' % (update.release.id_prefix,
time.localtime()[0]))
@@ -171,47 +171,47 @@ class TestUpdate(ModelTest):
otherrel = model.Release(name=u'fc10', long_name=u'Fedora 10',
id_prefix=u'FEDORA',
dist_tag=u'dist-fc10')
update.release = otherrel
- update.assign_id()
+ update.assign_alias()
eq_(update.alias, u'%s-%s-0003' % (update.release.id_prefix,
time.localtime()[0]))
## 10k bug
update.alias = u'FEDORA-2010-9999'
newupdate = self.get_update(name=u'nethack-2.5.6-1.fc10')
- newupdate.assign_id()
+ newupdate.assign_alias()
eq_(newupdate.alias, u'FEDORA-2010-10000')
newerupdate = self.get_update(name=u'nethack-2.5.7-1.fc10')
- newerupdate.assign_id()
+ newerupdate.assign_alias()
eq_(newerupdate.alias, u'FEDORA-2010-10001')
- ## test updates that were pushed at the same time. assign_id should
+ ## test updates that were pushed at the same time. assign_alias should
## be able to figure out which one has the highest id.
now = datetime.utcnow()
newupdate.date_pushed = now
newerupdate.date_pushed = now
newest = self.get_update(name=u'nethack-2.5.8-1.fc10')
- newest.assign_id()
+ newest.assign_alias()
eq_(newest.alias, u'FEDORA-2010-10002')
def test_epel_id(self):
""" Make sure we can handle id_prefixes that contain dashes. eg:
FEDORA-EPEL """
# Create a normal Fedora update first
update = self.obj
- update.assign_id()
+ update.assign_alias()
eq_(update.alias, u'FEDORA-%s-0001' % time.localtime()[0])
update = self.get_update(name=u'TurboGears-2.1-1.el5')
release = model.Release(name=u'EL-5', long_name=u'Fedora EPEL
5',
dist_tag=u'dist-5E-epel',
id_prefix=u'FEDORA-EPEL')
update.release = release
- update.assign_id()
+ update.assign_alias()
eq_(update.alias, u'FEDORA-EPEL-%s-0001' % time.localtime()[0])
update = self.get_update(name=u'TurboGears-2.2-1.el5')
update.release = release
- update.assign_id()
+ update.assign_alias()
eq_(update.alias, u'%s-%s-0002' % (release.id_prefix,
time.localtime()[0]))