apache/bodhi.conf | 11 +--
apache/bodhi.wsgi | 4 +
bodhi.egg-info/SOURCES.txt | 1
bodhi.egg-info/sqlobject.txt | 2
bodhi/commands.py | 4 +
bodhi/config/app.cfg | 1
bodhi/controllers.py | 14 +++-
bodhi/model.py | 4 -
bodhi/new.py | 4 -
bodhi/release.py | 4 -
bodhi/rss.py | 3
bodhi/templates/login.html | 28 ++++++++
bodhi/templates/master.html | 146 +++++++++++++++++++++++++++++++++++++++++++
bodhi/templates/pkg.kid | 4 -
bodhi/util.py | 10 ++
bodhi/widgets.py | 4 -
16 files changed, 224 insertions(+), 20 deletions(-)
New commits:
commit 0823405c82da48837063ea33c10789867a68a966
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Sep 14 13:05:16 2009 -0400
0.6.8, and bring our WSGI app up to speed with Fedora infrastructure
diff --git a/apache/bodhi.conf b/apache/bodhi.conf
index aec4442..b7b8e74 100644
--- a/apache/bodhi.conf
+++ b/apache/bodhi.conf
@@ -1,16 +1,15 @@
Alias /updates/static /usr/share/bodhi/static
-WSGIDaemonProcess bodhi user=apache group=apache display-name=bodhi maximum-requests=1000
processes=2 threads=1
-
+WSGIDaemonProcess bodhi user=apache group=apache maximum-requests=1000 display-name=bodhi
processes=2 threads=1
WSGISocketPrefix run/wsgi
WSGIRestrictStdout On
WSGIRestrictSignal Off
-WSGIPythonOptimize 2
+WSGIPythonOptimize 1
-WSGIScriptAlias /updates /usr/share/bodhi/bodhi.wsgi
+WSGIScriptAlias /updates /usr/share/bodhi/bodhi.wsgi/updates
-<Directory /usr/share/bodhi>
+<Location /updates>
WSGIProcessGroup bodhi
Order deny,allow
Allow from all
-</Directory>
+</Location>
diff --git a/bodhi/release.py b/bodhi/release.py
index 4db45d9..c331e94 100644
--- a/bodhi/release.py
+++ b/bodhi/release.py
@@ -1,9 +1,9 @@
-VERSION = '0.6.7'
+VERSION = '0.6.8'
NAME = 'bodhi'
DESCRIPTION = 'Bodhi is a modular web-system that facilitates the process of
publishing updates for a Fedora-based software distribution'
AUTHOR = 'Luke Macken'
EMAIL = 'lmacken(a)redhat.com'
-COPYRIGHT = '2007-2008 Red Hat, Inc.'
+COPYRIGHT = '2007-2009 Red Hat, Inc.'
URL = 'https://fedorahosted.org/bodhi'
DOWNLOAD_URL = 'https://fedorahosted.org/releases/b/o/bodhi/'
LICENSE = 'GPLv2'
commit 49574994a710fe3cd67fd5a56e84ad5fea61073b
Merge: 81f6c88... 8baddfc...
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Sep 14 13:02:05 2009 -0400
Merge branch 'master' of
git+ssh://git.fedorahosted.org/git/bodhi
Conflicts:
bodhi.egg-info/PKG-INFO
commit 81f6c882fbd09ec63b8076f304412ae0cf3b0e22
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Sep 14 12:59:59 2009 -0400
Elaborate on our bugzilla error message
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 50e9f7d..6e60eff 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -781,7 +781,7 @@ class Root(controllers.RootController):
update.update_bugs(bugs)
except xmlrpclib.Fault, f:
log.exception(f)
- note.insert(0, "Unable to access one or more bugs")
+ note.insert(0, "Unable to access one or more bugs: %s" %
str(f))
except Exception, e:
log.error("Unknown exception thrown from python-bugzilla!")
note.insert(0, "Unable to access one or more bugs. Exception:
%s" % e)
commit e285b56af6111c356875a31aa86d55bdd3ae4341
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Sep 14 12:58:45 2009 -0400
Add [optional] support for CSRF protection (#342)
To enable it, set identity.provider='sqlobjectcsrf' in your configuration.
However, the test suite does not work with CSRF protection enabled.
diff --git a/apache/bodhi.wsgi b/apache/bodhi.wsgi
index 0e11996..86e26f5 100644
--- a/apache/bodhi.wsgi
+++ b/apache/bodhi.wsgi
@@ -10,6 +10,7 @@ import atexit
import cherrypy
import cherrypy._cpwsgi
import turbogears
+from fedora.tg.util import enable_csrf
from bodhi.util import load_config
load_config()
@@ -19,6 +20,9 @@ turbogears.config.update({'global': {'autoreload.on':
False}})
turbogears.config.update({'global': {'server.log_to_screen': False}})
#turbogears.config.update({'global': {'server.webpath': None}})
+if turbogears.config.get('identity.provider') in ('sqlobjectcsrf',
'jsonfas2'):
+ turbogears.startup.call_on_startup.append(enable_csrf)
+
from bodhi import jobs
turbogears.startup.call_on_startup.append(jobs.schedule)
diff --git a/bodhi/commands.py b/bodhi/commands.py
index 0959fd9..bb8a8c0 100644
--- a/bodhi/commands.py
+++ b/bodhi/commands.py
@@ -41,6 +41,10 @@ def start():
else:
load_config()
+ from fedora.tg.util import enable_csrf
+ if turbogears.config.get('identity.provider') in ('sqlobjectcsrf',
'jsonfas2'):
+ turbogears.startup.call_on_startup.append(enable_csrf)
+
## Schedule our periodic tasks
from bodhi import jobs
turbogears.startup.call_on_startup.append(jobs.schedule)
diff --git a/bodhi/config/app.cfg b/bodhi/config/app.cfg
index 5a99790..0cf1843 100644
--- a/bodhi/config/app.cfg
+++ b/bodhi/config/app.cfg
@@ -219,6 +219,7 @@ identity.on=True
# option must be specified.
identity.failure_url="/login"
+#identity.provider='sqlobjectcsrf'
#identity.provider='bugzilla'
# The names of the fields on the login form containing the visitor's user ID
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 03c5bbd..50e9f7d 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -32,6 +32,8 @@ from turbogears import (controllers, expose, validate, redirect,
identity,
from turbogears.widgets import DataGrid
from fedora.tg.util import request_format
+from fedora.tg.controllers import login as fc_login
+from fedora.tg.controllers import logout as fc_logout
from bodhi import buildsys, util
from bodhi.rss import Feed
@@ -150,6 +152,11 @@ class Root(controllers.RootController):
@expose(template="bodhi.templates.login", allow_json=True)
def login(self, forward_url=None, previous_url=None, *args, **kw):
+ if config.get('identity.provider') in ('sqlobjectcsrf',
'jsonfas2'):
+ data = fc_login(forward_url, previous_url, args, kw)
+ data['tg_template'] = 'genshi:bodhi.templates.login'
+ return data
+
if not identity.current.anonymous and identity.was_login_attempted() \
and not identity.get_identity_errors():
if request_format() == 'json':
@@ -173,8 +180,11 @@ class Root(controllers.RootController):
original_parameters=cherrypy.request.params,
forward_url=forward_url)
- @expose()
+ @expose(allow_json=True)
def logout(self):
+ if config.get('identity.provider') in ('sqlobjectcsrf',
'jsonfas2'):
+ return fc_logout()
+
identity.current.logout()
raise redirect('/')
diff --git a/bodhi/model.py b/bodhi/model.py
index 1caaa8b..33cf17e 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -23,7 +23,7 @@ import xmlrpclib
from sqlobject import *
from datetime import datetime
-from turbogears import config, url
+from turbogears import config
from turbogears.database import PackageHub
from os.path import isfile, join
@@ -31,7 +31,7 @@ from textwrap import wrap
from bodhi import buildsys, mail
from bodhi.util import get_nvr, rpm_fileheader, header, get_age, get_age_in_days
-from bodhi.util import Singleton, authorized_user, flash_log, build_evr
+from bodhi.util import Singleton, authorized_user, flash_log, build_evr, url
from bodhi.exceptions import RPMNotFound, InvalidRequest
from bodhi.identity.tables import *
diff --git a/bodhi/new.py b/bodhi/new.py
index ab20274..02369dd 100644
--- a/bodhi/new.py
+++ b/bodhi/new.py
@@ -16,8 +16,10 @@ import os
import logging
from os.path import join
+from turbogears import expose, controllers, identity, config, flash
+
from bodhi.widgets import NewUpdateForm
-from turbogears import expose, controllers, identity, config, url, flash
+from bodhi.util import url
log = logging.getLogger(__name__)
update_form = NewUpdateForm()
diff --git a/bodhi/rss.py b/bodhi/rss.py
index 3e715b7..22e8f5d 100644
--- a/bodhi/rss.py
+++ b/bodhi/rss.py
@@ -14,10 +14,11 @@
import logging
from turbogears.feed import FeedController
-from turbogears import config, url
+from turbogears import config
from sqlobject import SQLObjectNotFound
from sqlobject.sqlbuilder import AND
+from bodhi.util import url
from bodhi.model import Release, PackageUpdate, Comment
log = logging.getLogger(__name__)
diff --git a/bodhi/templates/pkg.kid b/bodhi/templates/pkg.kid
index 1782a0b..9d226e4 100644
--- a/bodhi/templates/pkg.kid
+++ b/bodhi/templates/pkg.kid
@@ -14,8 +14,8 @@
<blockquote>
<h1>${pkg.name}</h1>
<ul>
- <li><a
href="http://bugz.fedoraproject.org/${pkg.name}">Open
Bugs</a></li>
- <li><a
href="https://admin.fedoraproject.org/pkgdb/packages/name/${pkg.name...
Database</a></li>
+ <li><a
href="${tg.url('http://bugz.fedoraproject.org/%s' %
(pkg.name,))}">Open Bugs</a></li>
+ <li><a
href="${tg.url('https://admin.fedoraproject.org/pkgdb/packages/n... %
(pkg.name,))}">Package Database</a></li>
<li><a
href="http://koji.fedoraproject.org/koji/search?terms=${pkg.name}&am...
Buildsystem</a></li>
</ul>
</blockquote>
diff --git a/bodhi/util.py b/bodhi/util.py
index a279146..cc48eb7 100644
--- a/bodhi/util.py
+++ b/bodhi/util.py
@@ -33,9 +33,10 @@ from yum.misc import checksum
from os.path import isdir, join, dirname, basename, isfile
from datetime import datetime
from decorator import decorator
-from turbogears import config, url, flash, redirect
+from turbogears import config, flash, redirect, url as tg_url
from fedora.tg.util import request_format
from fedora.client import PackageDB
+from fedora.tg.util import url as csrf_url
from bodhi.exceptions import (RPMNotFound, RepodataException,
InvalidUpdateException)
@@ -499,3 +500,10 @@ def testing_statistics():
print "mean = %d days" % (accumulative.days / len(deltas))
print "median = %d days" % deltas[len(deltas) / 2].days
print "mode = %d days" % mode
+
+
+def url(*args, **kw):
+ if config.get('identity.provider') in ('sqlobjectcsrf',
'jsonfas2'):
+ return csrf_url(*args, **kw)
+ else:
+ return tg_url(*args, **kw)
diff --git a/bodhi/widgets.py b/bodhi/widgets.py
index c2b63ab..bf2f98f 100644
--- a/bodhi/widgets.py
+++ b/bodhi/widgets.py
@@ -13,13 +13,13 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from tgcaptcha import CaptchaField
-from turbogears import validators, url, config
+from turbogears import validators, config
from turbogears.widgets import (Form, TextField, SubmitButton, TextArea,
AutoCompleteField, SingleSelectField, CheckBox,
HiddenField, RemoteForm, CheckBoxList, JSLink,
DataGrid, CSSLink)
-from bodhi.util import make_update_link
+from bodhi.util import make_update_link, url
from bodhi.validators import *
class CommentForm(Form):
commit 74fcf40e057465b76821e66a6770875d4bfbcd8e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Sep 14 12:57:15 2009 -0400
Add some initial master/login Genshi templates for CSRF support
diff --git a/bodhi/templates/login.html b/bodhi/templates/login.html
new file mode 100644
index 0000000..23e4e33
--- /dev/null
+++ b/bodhi/templates/login.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:py="http://genshi.edgewall.org/"
+
xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="master.html" />
+ <?python
+ import gettext
+ translation = gettext.translation('bodhi', '/usr/share/locale',
fallback=True)
+ _ = translation.ugettext
+ ?>
+ <xi:include href="${tg.fedora_template('login.html')}" />
+
+
+<head>
+ <meta content="text/html; charset=UTF-8"
+ http-equiv="content-type" py:replace="''"/>
+ <title>Login</title>
+</head>
+
+<body onload="document.login.user_name.focus()">
+ <blockquote>
+ <h1 class="padded">Fedora Update System</h1>
+ <p class="padded">${message}<br/>
+ Hint: Use your Fedora username, not your e-mail address.</p>
+ </blockquote>
+ <loginform>${message}</loginform>
+</body>
+</html>
diff --git a/bodhi/templates/master.html b/bodhi/templates/master.html
new file mode 100644
index 0000000..3d9ef20
--- /dev/null
+++ b/bodhi/templates/master.html
@@ -0,0 +1,146 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:py="http://genshi.edgewall.org/"
+
xmlns:xi="http://www.w3.org/2001/XInclude">
+
+<head py:match="head" py:attrs="select('@*')">
+ <meta content="text/html; charset=UTF-8"
http-equiv="content-type" py:replace="''"/>
+ <meta name="robots" content="noindex,nofollow" />
+ <link rel="shortcut icon" type="image/vnd.microsoft.icon"
href="${tg.url('/static/images/favicon.ico')}" />
+ <link rel="shortcut icon" type="image/x-icon"
href="${tg.url('/static/images/favicon.ico')}" />
+ <title py:replace="''">Your title goes here</title>
+ <script type="text/javascript" charset="utf-8"
src="${tg.url('/static/js/jquery.js')}"></script>
+ <script type="text/javascript" charset="utf-8"
src="${tg.url('/static/js/jquery.corner.js')}"></script>
+
+ <meta py:replace="select('*|text()')"/>
+
+ <style type="text/css" media="screen">
+ @import "${tg.url('/static/css/layout.css')}";
+ </style>
+</head>
+
+<body py:match="body" py:attrs="select('@*')">
+
+<?python
+from bodhi import version, hostname
+from bodhi.model import Release, PackageUpdate, Releases
+from bodhi.search import search_form
+from sqlobject.sqlbuilder import AND
+?>
+
+<!-- Make any form submission change the bodhi logo into a spinner -->
+<script type="text/javascript">
+$(document).ready(function() {
+ $("form").submit( function() {
+ $("div[(a)id=bodhi-logo]").hide();
+ $("div[(a)id=wait]").show();
+ } );
+} );
+</script>
+<script type="text/javascript">
+ $(document).ready(function() {
+ $('div.flash').corner();
+ $('div.flash').show("slow");
+ });
+</script>
+
+ <!-- header BEGIN -->
+ <div id="fedora-header">
+ <div id="fedora-header-logo">
+ <a href="${tg.url('/')}"><img
src="${tg.url('/static/images/header-fedora_logo.png')}"
/></a>
+ </div>
+
+ <div id="fedora-header-items">
+ <table><tr><td> ${ET(search_form.display())}
</td><td>
+ <div id="bodhi-logo">
+ <a href="${tg.url('/')}"><img
src="${tg.url('/static/images/bodhi-icon-48.png')}" /></a>
+ </div>
+ <div id="wait" style="display: none">
+ <img src="${tg.url('/static/images/wait.gif')}"
height="48" width="48"/>
+ </div>
+ </td></tr></table>
+ </div>
+ </div>
+
+ <div id="fedora-nav"></div>
+ <!-- header END -->
+
+ <!-- leftside BEGIN -->
+ <div id="fedora-side-left">
+ <div id="fedora-side-nav-label">Site Navigation:</div>
+ <div py:if="not tg.identity.anonymous and 'releng' in
tg.identity.groups">
+ <ul id="fedora-side-nav">
+ <li><a id="administration"
href="#">Administration</a></li>
+ <div id="adminlist">
+ <ul>
+ <li><a
href="${tg.url('/admin/push')}">Requests</a></li>
+ <li><a
href="${tg.url('/admin/masher')}">Masher</a></li>
+ </ul>
+ </div>
+ </ul>
+ </div>
+ <div py:if="not tg.identity.anonymous and 'security_respons'
in tg.identity.groups">
+ <ul id="fedora-side-nav">
+ <li><a
href="${tg.url('/security')}">Security Queue</a></li>
+ </ul>
+ </div>
+ <ul id="fedora-side-nav">
+ <li><a
href="${tg.url('/')}">${tg.identity.anonymous and ' ' or
"%s's " % tg.identity.user_name}Home</a></li>
+ <li py:if="not tg.identity.anonymous"><a
href="${tg.url('/mine')}">My Updates
(${PackageUpdate.select(PackageUpdate.q.submitter ==
tg.identity.user_name).count()})</a></li>
+ <li py:if="not tg.identity.anonymous"><a
href="${tg.url('/new')}">New Update</a></li>
+ <li py:for="release in Releases().data">
+ <a id="${release['name']}"
href="${tg.url('/%s' %
release['name'])}">${release['long_name']}</a>
+ <div id="${release['name']}_releases">
+ <ul>
+ <li class="release">
+ <a href="${tg.url('/metrics?release=%s' %
release['name'])}" class="link">Metrics</a><a
href="${tg.url('/metrics?release=%s' % release['name'])}"
class="rsslink"><img
src="${tg.url('/static/images/metrics-small.png')}"/></a>
+ </li>
+ <li py:for="status in ('pending',
'testing', 'stable')" class="release">
+ <a href="${tg.url('/%s/%s' %
(release['name'], status != 'stable' and status or ''))}"
class="link">${status.title()} (${release['num_' +
status]})</a> <a
href="${tg.url('/rss/rss2.0?release=%s&status=%s' %
(release['name'], status))}" class="rsslink"><img
src="${tg.url('/static/images/rss.png')}" /></a>
+ </li>
+ <li class="release">
+ <a href="${tg.url('/%s/security' %
release['name'])}" class="link">Security
(${release['num_security']})</a> <a
href="${tg.url('/rss/rss2.0?release=%s&type=security' %
release['name'])}" class="rsslink"><img
src="${tg.url('/static/images/rss.png')}" /></a>
+ </li>
+ </ul>
+ </div>
+ </li>
+ <li class="release"><a
href="${tg.url('/comments')}"
class="link">Comments</a><a
href="${tg.url('/rss/rss2.0?comments=True')}"
class="rsslink"><img
src="${tg.url('/static/images/rss.png')}" /></a>
+ </li>
+ <li py:if="not tg.identity.anonymous"><a
href="${tg.url('/logout')}">Logout</a></li>
+ <li py:if="tg.identity.anonymous"><a
href="${tg.url('/login')}">Login</a></li>
+ </ul>
+ </div>
+ <!-- leftside END -->
+
+ <!-- content BEGIN -->
+ <div id="fedora-middle-two">
+ <div class="fedora-corner-tr"></div>
+ <div class="fedora-corner-tl"></div>
+
+ <div id="fedora-content">
+
+ <div id="page-main">
+
+ <center>
+ <div style="display: none;" id="flash"
py:if="tg_flash" class="flash"
py:content="tg_flash"></div>
+ </center>
+ <div py:replace="select('*|text()')" />
+ </div>
+ </div>
+ <div class="fedora-corner-br"></div>
+ <div class="fedora-corner-bl"></div>
+ </div>
+ <!-- content END -->
+
+ <!-- footer BEGIN -->
+ <div id="fedora-footer">
+ Bodhi Version: ${version} -- Server: ${hostname}<br/>
+ Copyright © 2007-2008 Red Hat, Inc. and others. All Rights
Reserved.<br/>
+ Licensed under the GNU Public License v2 or later.<br />
+ The Fedora Project is maintained and driven by the community and sponsored by Red
Hat.<br/>This is a community maintained site. Red Hat is not responsible for
content.<br/>
+ [ <a
href="http://fedoraproject.org/wiki/Legal">Legal</a>,
<a
href="http://fedoraproject.org/wiki/Legal/TrademarkGuidelines"&...
Guidelines</a> ]
+ </div>
+ <!-- footer END -->
+
+</body>
+</html>
commit 6ecfa8ed2caa8e036301677fe1416e1e19bb8e09
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Aug 11 16:58:26 2009 -0400
Stupid merge conflict
diff --git a/bodhi.egg-info/PKG-INFO b/bodhi.egg-info/PKG-INFO
index 55e00f9..8aa179f 100644
--- a/bodhi.egg-info/PKG-INFO
+++ b/bodhi.egg-info/PKG-INFO
@@ -1,6 +1,10 @@
Metadata-Version: 1.0
Name: bodhi
+<<<<<<< Updated upstream:bodhi.egg-info/PKG-INFO
Version: 0.6.2
+=======
+Version: 0.6.3
+>>>>>>> Stashed changes:bodhi.egg-info/PKG-INFO
Summary: Bodhi is a modular web-system that facilitates the process of publishing updates
for a Fedora-based software distribution
Home-page:
https://fedorahosted.org/bodhi
Author: Luke Macken
diff --git a/bodhi.egg-info/SOURCES.txt b/bodhi.egg-info/SOURCES.txt
index f956a4c..ad6a33f 100644
--- a/bodhi.egg-info/SOURCES.txt
+++ b/bodhi.egg-info/SOURCES.txt
@@ -136,7 +136,6 @@ bodhi/templates/comments.kid
bodhi/templates/confirmation.kid
bodhi/templates/form.kid
bodhi/templates/list.kid
-bodhi/templates/login.kid
bodhi/templates/masher.kid
bodhi/templates/master.kid
bodhi/templates/metrics.kid
diff --git a/bodhi.egg-info/sqlobject.txt b/bodhi.egg-info/sqlobject.txt
new file mode 100644
index 0000000..dc9ca11
--- /dev/null
+++ b/bodhi.egg-info/sqlobject.txt
@@ -0,0 +1,2 @@
+db_module=bodhi.model
+history_dir=$base/bodhi/sqlobject-history