Branch 'pyramid' - 2 commits - bodhi/__init__.py bodhi/templates bodhi/tests bodhi/views.py
by Luke Macken
bodhi/__init__.py | 6 ++++++
bodhi/templates/404.mak | 13 +++++++++++++
bodhi/tests/functional/test_wsgi.py | 3 ++-
bodhi/views.py | 6 ++++++
4 files changed, 27 insertions(+), 1 deletion(-)
New commits:
commit 19500945ca2f4a4da57c1ef37e586608640d3267
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 29 20:40:23 2011 -0400
Configure our mako.directories when running the test suite
diff --git a/bodhi/tests/functional/test_wsgi.py b/bodhi/tests/functional/test_wsgi.py
index 63e7d59..acb2318 100644
--- a/bodhi/tests/functional/test_wsgi.py
+++ b/bodhi/tests/functional/test_wsgi.py
@@ -9,7 +9,8 @@ def setup():
from bodhi import main
from webtest import TestApp
global app
- app = main({}, **{'sqlalchemy.url': 'sqlite://'})
+ app = main({}, **{'sqlalchemy.url': 'sqlite://',
+ 'mako.directories': 'bodhi:templates'})
app = TestApp(app)
class FunctionalTests(unittest.TestCase):
commit 6ac763fe2086d0146fe40a871cd0fd55e40effdc
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 29 20:25:35 2011 -0400
Add a custom sad panda 404 page
diff --git a/bodhi/__init__.py b/bodhi/__init__.py
index c55c28f..bb04209 100644
--- a/bodhi/__init__.py
+++ b/bodhi/__init__.py
@@ -1,5 +1,6 @@
from sqlalchemy import engine_from_config
+from pyramid.exceptions import NotFound
from pyramid.decorator import reify
from pyramid.request import Request
from pyramid.security import unauthenticated_userid
@@ -68,4 +69,9 @@ def main(global_config, **settings):
config.add_translation_dirs('bodhi:locale/')
+ # 404
+ config.add_view('bodhi.views.notfound_view',
+ renderer='bodhi:templates/404.mak',
+ context=NotFound)
+
return config.make_wsgi_app()
diff --git a/bodhi/templates/404.mak b/bodhi/templates/404.mak
new file mode 100644
index 0000000..5bb2056
--- /dev/null
+++ b/bodhi/templates/404.mak
@@ -0,0 +1,13 @@
+<html>
+ <head>
+ <title>File not found</title>
+ </head>
+ <body>
+ <center>
+ <h1>Sorry! We couldn't find that file.</h1>
+ <br/>
+ <img src="https://fedoraproject.org/static/images/panda-question.png"/>
+ <br/>
+ </center>
+ </body>
+</html>
diff --git a/bodhi/views.py b/bodhi/views.py
index 9d0752f..79f9345 100644
--- a/bodhi/views.py
+++ b/bodhi/views.py
@@ -35,6 +35,12 @@ def view_model(context, request):
'grid': grid, 'page': page}
+## 404
+
+def notfound_view(context, request):
+ request.response_status = 404
+ return dict()
+
## Widgets
def view_widget(context, request):
12 years, 7 months
Branch 'pyramid' - 8 commits - bodhi/buildsys.py bodhi/__init__.py bodhi/models bodhi/resources.py bodhi/tests bodhi/util.py bodhi/views.py bodhi/widgets.py development.ini setup.py
by Luke Macken
bodhi/__init__.py | 23 ++++++++++++---
bodhi/buildsys.py | 51 +++++++++++++----------------------
bodhi/models/models.py | 26 ++++++++---------
bodhi/resources.py | 2 +
bodhi/tests/models/test_models.py | 10 +++---
bodhi/util.py | 2 +
bodhi/views.py | 10 ++++++
bodhi/widgets.py | 55 ++++++++++++++++++++++++++++++++++++++
development.ini | 28 +++++++++++++++++++
setup.py | 22 ++++++++++++++-
10 files changed, 173 insertions(+), 56 deletions(-)
New commits:
commit 363e64843eeb79ee471da8aa167bb3ad1bd0306b
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 29 02:06:49 2011 -0400
Validator tweaking
diff --git a/bodhi/widgets.py b/bodhi/widgets.py
index 91279f6..0b6ba23 100644
--- a/bodhi/widgets.py
+++ b/bodhi/widgets.py
@@ -47,9 +47,9 @@ class NewUpdateForm(tw2.sqla.DbFormPage):
autokarma = tw2.forms.CheckBox(label='Enable karma automatism',
validator=tw2.core.BoolValidator())
stablekarma = tw2.forms.TextField(label='Stable threshold', size=2,
- value=3, validator=tw2.core.IntValidator())
+ value=3, validator=tw2.core.IntValidator(min=1))
unstablekarma = tw2.forms.TextField(label='Unstable threshold', size=2,
- value=-3, validator=tw2.core.IntValidator())
+ value=-3, validator=tw2.core.IntValidator(max=-1))
reboot = tw2.forms.CheckBox(label='Suggest reboot',
validator=tw2.core.BoolValidator())
commit de90e5f722675d491539e6894b80d12eeed68f86
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 29 02:06:04 2011 -0400
Go back to using full names for our enums, since the test suite still works
diff --git a/bodhi/models/models.py b/bodhi/models/models.py
index 42ef3a4..037a392 100644
--- a/bodhi/models/models.py
+++ b/bodhi/models/models.py
@@ -80,23 +80,23 @@ Base.query = DBSession.query_property()
##
class UpdateStatus(DeclEnum):
- pending = 'P', 'pending'
- testing = 'T', 'testing'
- stable = 'S', 'stable'
- unpushed = 'U', 'unpushed'
- obsolete = 'O', 'obsolete'
+ pending = 'pending', 'pending'
+ testing = 'testing', 'testing'
+ stable = 'stable', 'stable'
+ unpushed = 'unpushed', 'unpushed'
+ obsolete = 'obsolete', 'obsolete'
class UpdateType(DeclEnum):
- bugfix = 'B', 'bugfix'
- security = 'S', 'security'
- newpackage = 'N', 'new package'
- enhancement = 'E', 'enhancement'
+ bugfix = 'bugfix', 'bugfix'
+ security = 'security', 'security'
+ newpackage = 'newpackage', 'new package'
+ enhancement = 'enhancement', 'enhancement'
class UpdateRequest(DeclEnum):
- testing = 'T', 'testing'
- stable = 'S', 'stable'
- obsolete = 'O', 'obsolete'
- unpush = 'U', 'unpush'
+ testing = 'testing', 'testing'
+ stable = 'stable', 'stable'
+ obsolete = 'obsolete', 'obsolete'
+ unpush = 'unpush', 'unpush'
##
## Association tables
diff --git a/bodhi/tests/models/test_models.py b/bodhi/tests/models/test_models.py
index ddd5a01..d564693 100644
--- a/bodhi/tests/models/test_models.py
+++ b/bodhi/tests/models/test_models.py
@@ -280,28 +280,28 @@ class TestUpdate(ModelTest):
def test_set_request_unpush(self):
eq_(self.obj.status, UpdateStatus.pending)
self.obj.status = UpdateStatus.testing
- self.obj.set_request('U')
+ self.obj.set_request('unpush')
eq_(self.obj.status, UpdateStatus.unpushed)
@raises(InvalidRequest)
def test_set_request_testing(self):
- self.obj.set_request('T')
+ self.obj.set_request('testing')
def test_set_request_stable(self):
eq_(self.obj.status, UpdateStatus.pending)
- self.obj.set_request('S')
+ self.obj.set_request('stable')
eq_(self.obj.status, UpdateStatus.pending)
# TODO: verify results (via session flash?)
def test_set_request_obsolete(self):
eq_(self.obj.status, UpdateStatus.pending)
- self.obj.set_request('O')
+ self.obj.set_request('obsolete')
eq_(self.obj.status, UpdateStatus.obsolete)
def test_request_complete(self):
self.obj.request = None
eq_(self.obj.date_pushed, None)
- self.obj.set_request('T')
+ self.obj.set_request('testing')
self.obj.request_complete()
eq_(self.obj.pushed, True)
assert self.obj.date_pushed
commit 180cba5dd0687482885fae8b9aad56501f9ee9c1
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 29 02:04:45 2011 -0400
Refactor how we handle buildsystem configuration
diff --git a/bodhi/__init__.py b/bodhi/__init__.py
index 25af2c9..c55c28f 100644
--- a/bodhi/__init__.py
+++ b/bodhi/__init__.py
@@ -8,6 +8,7 @@ from pyramid_beaker import session_factory_from_settings
from pyramid_beaker import set_cache_regions_from_settings
from bodhi.resources import appmaker
+import bodhi.buildsys
#class BodhiRequest(Request):
# @reify
@@ -27,6 +28,9 @@ def main(global_config, **settings):
engine = engine_from_config(settings, 'sqlalchemy.')
get_root = appmaker(engine)
+ # Setup our buildsystem
+ bodhi.buildsys.setup_buildsystem(settings)
+
# Beaker Sessions & Caching
session_factory = session_factory_from_settings(settings)
set_cache_regions_from_settings(settings)
diff --git a/bodhi/buildsys.py b/bodhi/buildsys.py
index 26447d9..bc62c3a 100644
--- a/bodhi/buildsys.py
+++ b/bodhi/buildsys.py
@@ -16,19 +16,12 @@ import koji
import logging
from os.path import join, expanduser
-
-
-#from tg import config
-# FIXME:
-config = {}
-
from bodhi.util import get_nvr
log = logging.getLogger(__name__)
-## Our buildsystem session. This could be a koji ClientSession or an instance
-## of our Buildsystem class.
-session = None
+_buildsystem = None
+
class Buildsystem:
"""
@@ -131,7 +124,7 @@ class DevBuildsys(Buildsystem):
return [{'build_id': 127983, 'tag_name': 'dist-f11-updates', 'owner_name': 'toshio', 'package_name': 'TurboGears', 'task_id': 1616247, 'creation_event_id': 1952597, 'creation_time': '2009-08-20 03:29:55.31542', 'epoch': None, 'tag_id': 87, 'name': 'TurboGears', 'completion_time': '2009-08-20 03:33:51.134736', 'state': 1, 'version': '1.0.8', 'release': '7.fc11', 'package_id': 1256, 'owner_id': 293, 'id': 127983, 'nvr': 'TurboGears-1.0.8-7.fc11'}]
-def koji_login(client=None, clientca=None, serverca=None):
+def koji_login(config, client=None, clientca=None, serverca=None):
"""
Login to Koji and return the session
"""
@@ -152,32 +145,26 @@ def koji_login(client=None, clientca=None, serverca=None):
koji_session.ssl_login(client, clientca, serverca)
return koji_session
+
def get_session():
""" Get a new buildsystem instance """
- session = None
- buildsys = config.get('buildsystem')
- if buildsys == 'koji':
- session = koji_login()
- elif buildsys in ('dev', None):
- session = DevBuildsys()
- return session
+ global _buildsystem
+ if not _buildsystem:
+ log.warning('No buildsystem configured; assuming testing')
+ return DevBuildsys()
+ return _buildsystem()
-def _get_session():
- """
- Get our buildsystem instance.
- :deprecated: This returns a "singleton" instance, but seems to
- cause some issues in production.
- """
- global session
- if not session:
- buildsys = config.get('buildsystem')
- log.info("Creating new %s buildsystem instance" % buildsys)
- if buildsys == 'koji':
- session = koji_login()
- elif buildsys == 'dev':
- session = DevBuildsys()
- return session
+def setup_buildsystem(settings):
+ global _buildsystem
+ assert not _buildsystem, "Buildsystem already configured?"
+ buildsys = settings.get('buildsystem')
+ if buildsys == 'koji':
+ log.debug('Using Koji Buildsystem')
+ _buildsystem = lambda: koji_login(config=settings)
+ elif buildsys in ('dev', None):
+ log.debug('Using DevBuildsys')
+ _buildsystem = DevBuildsys
def wait_for_tasks(tasks, sleep=300):
diff --git a/development.ini b/development.ini
index f1bc66b..d83a0cd 100644
--- a/development.ini
+++ b/development.ini
@@ -24,6 +24,14 @@ cache.short_term.expire = 60
cache.default_term.expire = 300
cache.long_term.expire = 3600
+# buildsystem settings
+buildsystem = koji
+koji_hub = https://koji.fedoraproject.org/kojihub
+koji_url = http://koji.fedoraproject.org
+#client_cert = None
+#clientca_cert = None
+#serverca_cert = None
+
[pipeline:main]
pipeline =
egg:WebError#evalerror
commit f73fb0385a20200ca96133501779a2e9d6d3ef2d
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 29 02:03:08 2011 -0400
Setup sessions & caching
diff --git a/bodhi/__init__.py b/bodhi/__init__.py
index 64ed70d..25af2c9 100644
--- a/bodhi/__init__.py
+++ b/bodhi/__init__.py
@@ -4,6 +4,8 @@ from pyramid.decorator import reify
from pyramid.request import Request
from pyramid.security import unauthenticated_userid
from pyramid.config import Configurator
+from pyramid_beaker import session_factory_from_settings
+from pyramid_beaker import set_cache_regions_from_settings
from bodhi.resources import appmaker
@@ -25,12 +27,12 @@ def main(global_config, **settings):
engine = engine_from_config(settings, 'sqlalchemy.')
get_root = appmaker(engine)
- # Sessions
- #from pyramid_beaker import session_factory_from_settings
- #session_factory = session_factory_from_settings(settings)
+ # Beaker Sessions & Caching
+ session_factory = session_factory_from_settings(settings)
+ set_cache_regions_from_settings(settings)
- config = Configurator(settings=settings, root_factory=get_root)
- #session_factory=session_factory)
+ config = Configurator(settings=settings, root_factory=get_root,
+ session_factory=session_factory)
#config.set_request_factory(BodhiRequest)
config.add_static_view('static', 'bodhi:static')
diff --git a/development.ini b/development.ini
index 2a8a512..f1bc66b 100644
--- a/development.ini
+++ b/development.ini
@@ -10,6 +10,20 @@ default_locale_name = en
sqlalchemy.url = sqlite:///%(here)s/bodhi.db
mako.directories = bodhi:templates
+# pyramid_beaker
+session.type = file
+session.data_dir = %(here)s/data/sessions/data
+session.lock_dir = %(here)s/data/sessions/lock
+session.key = mykey
+session.secret = ChangeThisSecret!!1
+session.cookie_on_exception = true
+cache.regions = default_term, second, short_term, long_term
+cache.type = memory
+cache.second.expire = 1
+cache.short_term.expire = 60
+cache.default_term.expire = 300
+cache.long_term.expire = 3600
+
[pipeline:main]
pipeline =
egg:WebError#evalerror
diff --git a/setup.py b/setup.py
index d51149e..91d31d3 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,13 @@ CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
requires = [
'pyramid',
+ 'pyramid_beaker',
+ 'WebError',
+
+ # not needed until we need need multiphase commits.
+ # we may want to enable this for the pyramid_mailer.
#'repoze.tm2>=1.0b1', # default_commit_veto
+
'sqlalchemy',
#'zope.sqlalchemy',
'WebError',
commit 82535c140b552cd8766cd04e4b82aedf8f5d7b81
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 29 02:00:05 2011 -0400
Bump our version to 2.0
diff --git a/setup.py b/setup.py
index 155f257..d51149e 100644
--- a/setup.py
+++ b/setup.py
@@ -29,7 +29,7 @@ if sys.version_info[:3] < (2,5,0):
requires.append('pysqlite')
setup(name='bodhi',
- version='0.0',
+ version='2.0',
description='bodhi',
long_description=README + '\n\n' + CHANGES,
classifiers=[
commit 30ac49cbdb888fc7bc5ed6befce4a1d2530f7dc1
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 29 01:58:54 2011 -0400
Proper i18n support (finally).
diff --git a/bodhi/__init__.py b/bodhi/__init__.py
index 09c660a..64ed70d 100644
--- a/bodhi/__init__.py
+++ b/bodhi/__init__.py
@@ -60,4 +60,6 @@ def main(global_config, **settings):
context='bodhi.widgets.NewUpdateForm',
renderer="bodhi:templates/widget.mak")
+ config.add_translation_dirs('bodhi:locale/')
+
return config.make_wsgi_app()
diff --git a/bodhi/util.py b/bodhi/util.py
index ba18d05..fc7fd7e 100644
--- a/bodhi/util.py
+++ b/bodhi/util.py
@@ -39,7 +39,9 @@ from fedora.client import PackageDB
from bodhi.exceptions import (RPMNotFound, RepodataException,
InvalidUpdateException)
+from pyramid.i18n import TranslationStringFactory
+_ = TranslationStringFactory('bodhi')
log = logging.getLogger(__name__)
## Display a given message as a heading
diff --git a/setup.py b/setup.py
index aed3d07..155f257 100644
--- a/setup.py
+++ b/setup.py
@@ -19,6 +19,10 @@ requires = [
'tw2.dynforms',
'tw2.forms',
'tw2.sqla',
+
+ # i18n
+ 'Babel',
+ 'lingua',
]
if sys.version_info[:3] < (2,5,0):
@@ -44,6 +48,10 @@ setup(name='bodhi',
install_requires = requires,
tests_require = requires,
test_suite="bodhi",
+ message_extractors = { '.': [
+ ('**.py', 'lingua_python', None),
+ ('**.mak', 'lingua_xml', None),
+ ]},
entry_points = """\
[paste.app_factory]
main = bodhi:main
commit 9ff15deb302f511c8a51a9f10c9f461347ced459
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 28 15:29:53 2011 -0400
Add some initial validators
diff --git a/bodhi/widgets.py b/bodhi/widgets.py
index 1143b13..91279f6 100644
--- a/bodhi/widgets.py
+++ b/bodhi/widgets.py
@@ -31,16 +31,25 @@ class NewUpdateForm(tw2.sqla.DbFormPage):
# auto-populate this with the latest-pkg candidate tag
version = tw2.forms.TextField()
- type_ = tw2.forms.SingleSelectField(options=bodhi.models.UpdateType.values())
- notes = tw2.forms.TextArea(rows=5, cols=50, validator=tw2.core.StringLengthValidator(min=10))
+ type_ = tw2.forms.SingleSelectField(
+ options=bodhi.models.UpdateType.values(),
+ validator=tw2.core.OneOfValidator(
+ values=bodhi.models.UpdateType.values()))
+ notes = tw2.forms.TextArea(rows=5, cols=50,
+ validator=tw2.core.StringLengthValidator(min=10))
class bugs(tw2.forms.TableFieldSet):
bugs = tw2.forms.TextField()
- closebugs = tw2.forms.CheckBox(label='Automatically close bugs')
+ closebugs = tw2.forms.CheckBox(label='Automatically close bugs',
+ validator=tw2.core.BoolValidator())
class karma(tw2.forms.TableFieldSet):
- autokarma = tw2.forms.CheckBox(label='Enable karma automatism')
- stablekarma = tw2.forms.TextField(label='Stable threshold', size=2, value=3)
- unstablekarma = tw2.forms.TextField(label='Unstable threshold', size=2, value=-3)
-
- reboot = tw2.forms.CheckBox(label='Suggest reboot')
+ autokarma = tw2.forms.CheckBox(label='Enable karma automatism',
+ validator=tw2.core.BoolValidator())
+ stablekarma = tw2.forms.TextField(label='Stable threshold', size=2,
+ value=3, validator=tw2.core.IntValidator())
+ unstablekarma = tw2.forms.TextField(label='Unstable threshold', size=2,
+ value=-3, validator=tw2.core.IntValidator())
+
+ reboot = tw2.forms.CheckBox(label='Suggest reboot',
+ validator=tw2.core.BoolValidator())
commit 8b3d6bbaa9e26e157252013c7e0614f47772f894
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 28 15:15:59 2011 -0400
Initial New Update Form using ToscaWidgets2
diff --git a/bodhi/__init__.py b/bodhi/__init__.py
index 12681e2..09c660a 100644
--- a/bodhi/__init__.py
+++ b/bodhi/__init__.py
@@ -55,4 +55,9 @@ def main(global_config, **settings):
context='bodhi.resources.BodhiResource',
renderer='bodhi:templates/model.mak')
+ # Widgets
+ config.add_view('bodhi.views.view_widget',
+ context='bodhi.widgets.NewUpdateForm',
+ renderer="bodhi:templates/widget.mak")
+
return config.make_wsgi_app()
diff --git a/bodhi/resources.py b/bodhi/resources.py
index 122b060..2095089 100644
--- a/bodhi/resources.py
+++ b/bodhi/resources.py
@@ -4,6 +4,7 @@ from sqlalchemy.orm.exc import NoResultFound
from bodhi.models import initialize_sql, DBSession
from bodhi.models import Update, Package, Build, Release, User, Bug, Comment
+from bodhi.widgets import NewUpdateForm
log = logging.getLogger(__name__)
@@ -81,6 +82,7 @@ def default_get_root(request):
u'comments': CommentResource,
u'users': UserResource,
u'bugs': BugResource,
+ u'new': lambda: NewUpdateForm.req(),
})
return root
diff --git a/bodhi/views.py b/bodhi/views.py
index 0ec2e33..9d0752f 100644
--- a/bodhi/views.py
+++ b/bodhi/views.py
@@ -33,3 +33,13 @@ def view_model(context, request):
context.__model__.grid_columns())
return {'caption': context.__model__.__name__ + 's',
'grid': grid, 'page': page}
+
+
+## Widgets
+
+def view_widget(context, request):
+ import tw2.core
+ context.fetch_data(request)
+ mw = tw2.core.core.request_local()['middleware']
+ mw.controllers.register(context, 'update_submit')
+ return {'widget':context}
diff --git a/bodhi/widgets.py b/bodhi/widgets.py
new file mode 100644
index 0000000..1143b13
--- /dev/null
+++ b/bodhi/widgets.py
@@ -0,0 +1,46 @@
+import tw2.core
+import tw2.forms
+import tw2.sqla
+import tw2.dynforms
+import tw2.jqplugins.jqgrid
+
+import bodhi.models
+
+
+class UpdateList(tw2.sqla.DbListPage):
+ entity = bodhi.models.Update
+ title = 'Updates'
+ newlink = tw2.forms.LinkField(link='/new', text='New', value=1)
+ class child(tw2.forms.GridLayout):
+ title = tw2.forms.LabelField()
+ id = tw2.forms.LinkField(link='/edit?id=$', text='Edit', label=None)
+
+
+class NewUpdateForm(tw2.sqla.DbFormPage):
+ entity = bodhi.models.Update
+ redirect = '/updates'
+ title = 'Submit a new update'
+
+ class child(tw2.dynforms.CustomisedTableForm):
+ action = '/save'
+ id = tw2.forms.HiddenField()
+
+ class builds(tw2.dynforms.GrowingGridLayout):
+ # TODO: package auto-completion
+ package = tw2.forms.TextField()
+ # auto-populate this with the latest-pkg candidate tag
+ version = tw2.forms.TextField()
+
+ type_ = tw2.forms.SingleSelectField(options=bodhi.models.UpdateType.values())
+ notes = tw2.forms.TextArea(rows=5, cols=50, validator=tw2.core.StringLengthValidator(min=10))
+
+ class bugs(tw2.forms.TableFieldSet):
+ bugs = tw2.forms.TextField()
+ closebugs = tw2.forms.CheckBox(label='Automatically close bugs')
+
+ class karma(tw2.forms.TableFieldSet):
+ autokarma = tw2.forms.CheckBox(label='Enable karma automatism')
+ stablekarma = tw2.forms.TextField(label='Stable threshold', size=2, value=3)
+ unstablekarma = tw2.forms.TextField(label='Unstable threshold', size=2, value=-3)
+
+ reboot = tw2.forms.CheckBox(label='Suggest reboot')
diff --git a/development.ini b/development.ini
index fac620a..2a8a512 100644
--- a/development.ini
+++ b/development.ini
@@ -13,8 +13,14 @@ mako.directories = bodhi:templates
[pipeline:main]
pipeline =
egg:WebError#evalerror
+ tw2
bodhi
+[filter:tw2]
+use = egg:tw2.core#middleware
+#controller_prefix = /tw2_controllers/
+serve_controllers = False
+
#[filter:tm]
#use = egg:repoze.tm2#tm
#commit_veto = repoze.tm:default_commit_veto
diff --git a/setup.py b/setup.py
index 114fcfa..aed3d07 100644
--- a/setup.py
+++ b/setup.py
@@ -13,6 +13,12 @@ requires = [
'sqlalchemy',
#'zope.sqlalchemy',
'WebError',
+
+ # tw2
+ 'tw2.core',
+ 'tw2.dynforms',
+ 'tw2.forms',
+ 'tw2.sqla',
]
if sys.version_info[:3] < (2,5,0):
12 years, 7 months
Branch 'pyramid_tw2' - bodhi/widgets.py
by Luke Macken
bodhi/widgets.py | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
New commits:
commit 9ff15deb302f511c8a51a9f10c9f461347ced459
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 28 15:29:53 2011 -0400
Add some initial validators
diff --git a/bodhi/widgets.py b/bodhi/widgets.py
index 1143b13..91279f6 100644
--- a/bodhi/widgets.py
+++ b/bodhi/widgets.py
@@ -31,16 +31,25 @@ class NewUpdateForm(tw2.sqla.DbFormPage):
# auto-populate this with the latest-pkg candidate tag
version = tw2.forms.TextField()
- type_ = tw2.forms.SingleSelectField(options=bodhi.models.UpdateType.values())
- notes = tw2.forms.TextArea(rows=5, cols=50, validator=tw2.core.StringLengthValidator(min=10))
+ type_ = tw2.forms.SingleSelectField(
+ options=bodhi.models.UpdateType.values(),
+ validator=tw2.core.OneOfValidator(
+ values=bodhi.models.UpdateType.values()))
+ notes = tw2.forms.TextArea(rows=5, cols=50,
+ validator=tw2.core.StringLengthValidator(min=10))
class bugs(tw2.forms.TableFieldSet):
bugs = tw2.forms.TextField()
- closebugs = tw2.forms.CheckBox(label='Automatically close bugs')
+ closebugs = tw2.forms.CheckBox(label='Automatically close bugs',
+ validator=tw2.core.BoolValidator())
class karma(tw2.forms.TableFieldSet):
- autokarma = tw2.forms.CheckBox(label='Enable karma automatism')
- stablekarma = tw2.forms.TextField(label='Stable threshold', size=2, value=3)
- unstablekarma = tw2.forms.TextField(label='Unstable threshold', size=2, value=-3)
-
- reboot = tw2.forms.CheckBox(label='Suggest reboot')
+ autokarma = tw2.forms.CheckBox(label='Enable karma automatism',
+ validator=tw2.core.BoolValidator())
+ stablekarma = tw2.forms.TextField(label='Stable threshold', size=2,
+ value=3, validator=tw2.core.IntValidator())
+ unstablekarma = tw2.forms.TextField(label='Unstable threshold', size=2,
+ value=-3, validator=tw2.core.IntValidator())
+
+ reboot = tw2.forms.CheckBox(label='Suggest reboot',
+ validator=tw2.core.BoolValidator())
12 years, 7 months
Branch 'pyramid' - bodhi/__init__.py
by Luke Macken
bodhi/__init__.py | 7 +++++++
1 file changed, 7 insertions(+)
New commits:
commit 70a1a6435ad5b5535a55dd279ad9fc22bd6e577e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Sep 27 21:24:34 2011 -0400
pyramid_beaker session prep
diff --git a/bodhi/__init__.py b/bodhi/__init__.py
index d3fc95c..12681e2 100644
--- a/bodhi/__init__.py
+++ b/bodhi/__init__.py
@@ -24,7 +24,14 @@ def main(global_config, **settings):
""" This function returns a WSGI application """
engine = engine_from_config(settings, 'sqlalchemy.')
get_root = appmaker(engine)
+
+ # Sessions
+ #from pyramid_beaker import session_factory_from_settings
+ #session_factory = session_factory_from_settings(settings)
+
config = Configurator(settings=settings, root_factory=get_root)
+ #session_factory=session_factory)
+
#config.set_request_factory(BodhiRequest)
config.add_static_view('static', 'bodhi:static')
12 years, 7 months
Changes to 'pyramid_tw2'
by Luke Macken
New branch 'pyramid_tw2' available with the following commits:
commit 8b3d6bbaa9e26e157252013c7e0614f47772f894
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 28 15:15:59 2011 -0400
Initial New Update Form using ToscaWidgets2
12 years, 7 months
Changes to 'pyramid_formalchemy'
by Luke Macken
New branch 'pyramid_formalchemy' available with the following commits:
commit fb96dfd7c3d10a6496edf286cbabc417249a10b5
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Sep 27 21:25:52 2011 -0400
Initial attempt at using FormAlchemy for SQLAlchemy form generation
commit 70a1a6435ad5b5535a55dd279ad9fc22bd6e577e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Sep 27 21:24:34 2011 -0400
pyramid_beaker session prep
12 years, 7 months
bodhi/controllers.py
by Luke Macken
bodhi/controllers.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit a292c6354ced985a9fd0f3f0d5f18f3e6c2e36d0
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 21 19:27:21 2011 -0400
fix a typo
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 969be0d..d4ee72b 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -773,7 +773,7 @@ class Root(controllers.RootController):
elif edited.request == 'testing':
koji.untagBuild(edited.release.pending_testing_tag,
build, force=True)
- except (TagError GenericError),e :
+ except (TagError, GenericError),e :
log.debug(str(e))
# Comment on the update with details of added/removed builds
12 years, 8 months
bodhi/controllers.py
by Luke Macken
bodhi/controllers.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 27b0a13b9cf932d39664260b567ecec2321e4080
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Sep 21 18:15:50 2011 -0400
Catch koji.GenericErrors when attempting to remove the pending tags
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 95ac4f8..969be0d 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -773,7 +773,7 @@ class Root(controllers.RootController):
elif edited.request == 'testing':
koji.untagBuild(edited.release.pending_testing_tag,
build, force=True)
- except TagError,e :
+ except (TagError GenericError),e :
log.debug(str(e))
# Comment on the update with details of added/removed builds
12 years, 8 months
bodhi/overrides.py
by Luke Macken
bodhi/overrides.py | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
New commits:
commit f1e28507ba625fa7101152d2a3bffe83f7498f87
Author: Luke Macken <lmacken(a)redhat.com>
Date: Sat Sep 17 14:36:55 2011 -0400
Allow people without rawhide commit rights to submit overrides.
This will determine the appropriate release for the given builds,
as opposed to hardcoding 'devel'.
diff --git a/bodhi/overrides.py b/bodhi/overrides.py
index 4766aa6..83c0df7 100644
--- a/bodhi/overrides.py
+++ b/bodhi/overrides.py
@@ -141,18 +141,6 @@ class BuildRootOverrideController(Controller):
release = None
n, v, r = get_nvr(build)
- # Make sure the user has commit rights
- try:
- people, groups = get_pkg_pushers(n)
- except Exception, e:
- flash(str(e))
- if request_format() == 'json': return dict()
- raise redirect('/override/new')
- if identity.current.user_name not in people[0]:
- flash("Error: You do not have commit privileges to %s" % n)
- if request_format() == 'json': return dict()
- raise redirect('/override/new')
-
# Make sure the build is tagged correctly
try:
tags = [tag['name'] for tag in koji.listTags(build)]
@@ -178,6 +166,25 @@ class BuildRootOverrideController(Controller):
if request_format() == 'json': return dict()
raise redirect('/override/new')
+ # Make sure the user has commit rights to the appropriate branch
+ pkgdb_args = {
+ 'collectionName': 'Fedora',
+ 'collectionVersion': 'devel',
+ }
+ pkgdb_args['collectionName'] = release.collection_name
+ pkgdb_args['collectionVersion'] = str(release.get_version())
+
+ try:
+ people, groups = get_pkg_pushers(n, **pkgdb_args)
+ except Exception, e:
+ flash(str(e))
+ if request_format() == 'json': return dict()
+ raise redirect('/override/new')
+ if identity.current.user_name not in people[0]:
+ flash("Error: You do not have commit privileges to %s" % n)
+ if request_format() == 'json': return dict()
+ raise redirect('/override/new')
+
# Create a new overrides object
try:
override = BuildRootOverride(build=build,
12 years, 8 months
bodhi/model.py
by Luke Macken
bodhi/model.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit c23b6a9c768a4c050ed90b798d19084fe1db7d13
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Sep 15 11:57:26 2011 -0400
More try/except robustibility around our koji overrides tagging
diff --git a/bodhi/model.py b/bodhi/model.py
index 30774b9..5af373f 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -1492,7 +1492,11 @@ class BuildRootOverride(SQLObject):
koji = buildsys.get_session()
log.debug('Untagging %s with %s' % (self.build,
self.release.override_tag))
- koji.untagBuild(self.release.override_tag, self.build, force=True)
+ try:
+ koji.untagBuild(self.release.override_tag, self.build, force=True)
+ except Exception, e:
+ log.exception(e)
+ log.error('There was non-fatal problem expiring the override')
def __json__(self):
return dict(build=self.build, date_submitted=self.date_submitted,
12 years, 8 months