pyramid/bodhi/bodhi/__init__.py | 20 +++++++++++++++- pyramid/bodhi/bodhi/models/models.py | 6 ++-- pyramid/bodhi/bodhi/tests/models/test_models.py | 29 ++++++++++++++++++++++-- pyramid/bodhi/development.ini | 7 ++--- pyramid/bodhi/production.ini | 7 ++--- pyramid/bodhi/setup.py | 4 +-- 6 files changed, 57 insertions(+), 16 deletions(-)
New commits: commit e917e4d23003c2837480781ffe10d7d05f68d050 Author: Luke Macken lmacken@redhat.com Date: Thu May 12 13:47:25 2011 -0400
Disable repoze.tm2 and zope.sqlalchemy
diff --git a/pyramid/bodhi/development.ini b/pyramid/bodhi/development.ini index 6cc0610..bef0deb 100644 --- a/pyramid/bodhi/development.ini +++ b/pyramid/bodhi/development.ini @@ -11,12 +11,11 @@ sqlalchemy.url = sqlite:///%(here)s/bodhi.db [pipeline:main] pipeline = egg:WebError#evalerror - tm bodhi
-[filter:tm] -use = egg:repoze.tm2#tm -commit_veto = repoze.tm:default_commit_veto +#[filter:tm] +#use = egg:repoze.tm2#tm +#commit_veto = repoze.tm:default_commit_veto
[server:main] use = egg:Paste#http diff --git a/pyramid/bodhi/production.ini b/pyramid/bodhi/production.ini index 9b46a3d..9590eb6 100644 --- a/pyramid/bodhi/production.ini +++ b/pyramid/bodhi/production.ini @@ -22,14 +22,13 @@ debug = false ;smtp_use_tls = ;error_message =
-[filter:tm] -use = egg:repoze.tm2#tm -commit_veto = repoze.tm:default_commit_veto +#[filter:tm] +#use = egg:repoze.tm2#tm +#commit_veto = repoze.tm:default_commit_veto
[pipeline:main] pipeline = weberror - tm bodhi
[server:main] diff --git a/pyramid/bodhi/setup.py b/pyramid/bodhi/setup.py index d1f27b0..114fcfa 100644 --- a/pyramid/bodhi/setup.py +++ b/pyramid/bodhi/setup.py @@ -9,9 +9,9 @@ CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [ 'pyramid', - 'repoze.tm2>=1.0b1', # default_commit_veto + #'repoze.tm2>=1.0b1', # default_commit_veto 'sqlalchemy', - 'zope.sqlalchemy', + #'zope.sqlalchemy', 'WebError', ]
commit 0296b0230ead0f49789dec91dbe4dff4890a335c Author: Luke Macken lmacken@redhat.com Date: Thu May 12 13:47:08 2011 -0400
More unit tests
diff --git a/pyramid/bodhi/bodhi/tests/models/test_models.py b/pyramid/bodhi/bodhi/tests/models/test_models.py index 359695f..63f82d9 100644 --- a/pyramid/bodhi/bodhi/tests/models/test_models.py +++ b/pyramid/bodhi/bodhi/tests/models/test_models.py @@ -300,9 +300,34 @@ class TestUpdate(ModelTest): eq_(self.obj.status, UpdateStatus.obsolete)
def test_request_complete(self): - eq_(self.obj.pushed, False) + self.obj.request = None eq_(self.obj.date_pushed, None) + self.obj.set_request('T') + self.obj.request_complete() eq_(self.obj.pushed, True) assert self.obj.date_pushed + eq_(self.obj.status, UpdateStatus.testing)
-# test multibuild update + def test_status_comment(self): + self.obj.status = UpdateStatus.testing + self.obj.status_comment() + eq_(len(self.obj.comments), 1) + eq_(self.obj.comments[0].author, u'bodhi') + eq_(self.obj.comments[0].text, u'This update has been pushed to testing') + self.obj.status = UpdateStatus.stable + self.obj.status_comment() + eq_(len(self.obj.comments), 2) + eq_(self.obj.comments[1].author, u'bodhi') + eq_(self.obj.comments[1].text, u'This update has been pushed to stable') + + def test_get_url(self): + eq_(self.obj.get_url(), u'/TurboGears-1.0.8-3.fc11') + self.obj.assign_alias() + eq_(self.obj.get_url(), u'/F11/FEDORA-%s-0001' % time.localtime()[0]) + + def test_get_build_tag(self): + eq_(self.obj.get_build_tag(), u'dist-f11-updates-candidate') + self.obj.status = UpdateStatus.testing + eq_(self.obj.get_build_tag(), u'dist-f11-updates-testing') + self.obj.status = UpdateStatus.stable + eq_(self.obj.get_build_tag(), u'dist-f11-updates')
commit d58e1d2750c04706ab04809253af5f5f96037c20 Author: Luke Macken lmacken@redhat.com Date: Thu May 12 13:46:44 2011 -0400
Add a custom BodhiRequest object so we can throw the 'user' on it, eventually.
diff --git a/pyramid/bodhi/bodhi/__init__.py b/pyramid/bodhi/bodhi/__init__.py index 44189ca..f8cbaa3 100644 --- a/pyramid/bodhi/bodhi/__init__.py +++ b/pyramid/bodhi/bodhi/__init__.py @@ -1,13 +1,31 @@ -from pyramid.config import Configurator from sqlalchemy import engine_from_config
+from pyramid.decorator import reify +from pyramid.request import Request +from pyramid.security import unauthenticated_userid +from pyramid.config import Configurator + from bodhi.models import appmaker
+class BodhiRequest(Request): + @reify + def user(self): + # <your database connection, however you get it, the below line + # is just an example> + dbconn = self.registry.settings['dbconn'] + userid = unauthenticated_userid(self) + if userid is not None: + # this should return None if the user doesn't exist + # in the database + return dbconn['users'].query({'id':userid}) + + def main(global_config, **settings): """ This function returns a WSGI application """ engine = engine_from_config(settings, 'sqlalchemy.') get_root = appmaker(engine) config = Configurator(settings=settings, root_factory=get_root) + config.set_request_factory(BodhiRequest) config.add_static_view('static', 'bodhi:static') config.add_view('bodhi.views.view_root', context='bodhi.models.Release',
commit a72186e9a6994554eff3fe55255df0833e0d6686 Author: Luke Macken lmacken@redhat.com Date: Thu May 12 13:46:38 2011 -0400
Fix a few SQLAlchemy warnings
diff --git a/pyramid/bodhi/bodhi/models/models.py b/pyramid/bodhi/bodhi/models/models.py index b5dccbc..e2674ac 100644 --- a/pyramid/bodhi/bodhi/models/models.py +++ b/pyramid/bodhi/bodhi/models/models.py @@ -495,12 +495,12 @@ class Update(Base): """ if self.status is UpdateStatus.stable: self.comment(u'This update has been pushed to stable', - author='bodhi') + author=u'bodhi') elif self.status is UpdateStatus.testing: self.comment(u'This update has been pushed to testing', - author='bodhi') + author=u'bodhi') elif self.status is UpdateStatus.obsolete: - self.comment(u'This update has been obsoleted', author='bodhi') + self.comment(u'This update has been obsoleted', author=u'bodhi')
def send_update_notice(self): log.debug("Sending update notice for %s" % self.title)