r5443 - branches/stability/wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-08-13 16:56:57 +0000 (Mon, 13 Aug 2012)
New Revision: 5443
Modified:
branches/stability/wooly/python/wooly/util.py
Log:
BZ840106
svn merge -c 5400 svn+ssh://svn.fedorahosted.org/svn/cumin/trunk .
svn merge -c 5437 svn+ssh://svn.fedorahosted.org/svn/cumin/trunk .
Modified: branches/stability/wooly/python/wooly/util.py
===================================================================
--- branches/stability/wooly/python/wooly/util.py 2012-08-13 16:53:06 UTC (rev 5442)
+++ branches/stability/wooly/python/wooly/util.py 2012-08-13 16:56:57 UTC (rev 5443)
@@ -6,6 +6,7 @@
import random
import sys
import time
+import struct
from copy import copy
from cStringIO import StringIO
@@ -24,13 +25,19 @@
return string
def unique_id():
- bits0 = random.getrandbits(32)
- bits1 = random.getrandbits(32)
- bits2 = random.getrandbits(32)
- bits3 = random.getrandbits(32)
- return "%08x-%08x-%08x-%08x" % (bits0, bits1, bits2, bits3)
+ # Generate 4 unsigned integers.
+ # Take 4 bytes from urandom and interpret
+ # them as a standard-sized ('=') unsigned long ('L').
+ # Unpack returns a tuple, hence the [0].
+ try:
+ bits = [struct.unpack("=L", os.urandom(4))[0] for x in range(4)]
+ except NotImplementedError:
+ bits = [random.getrandbits(32) for x in range(4)]
+ log.debug("Wooly: os.urandom raised NotImplementedError")
+ return "%08x-%08x-%08x-%08x" % (bits[0], bits[1], bits[2], bits[3])
+
def escape_amp(string):
return str(string).replace("&", "&")
11 years, 9 months
r5442 - in branches/stability: cumin/python/cumin/account wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-08-13 16:53:06 +0000 (Mon, 13 Aug 2012)
New Revision: 5442
Modified:
branches/stability/cumin/python/cumin/account/widgets.py
branches/stability/wooly/python/wooly/__init__.py
branches/stability/wooly/python/wooly/pages.py
Log:
BZ840110
BZ840110
svn merge -c 5398 svn+ssh://svn.fedorahosted.org/svn/cumin/trunk .
Modified: branches/stability/cumin/python/cumin/account/widgets.py
===================================================================
--- branches/stability/cumin/python/cumin/account/widgets.py 2012-08-06 15:46:10 UTC (rev 5441)
+++ branches/stability/cumin/python/cumin/account/widgets.py 2012-08-13 16:53:06 UTC (rev 5442)
@@ -76,6 +76,10 @@
form = LoginForm(app, "form")
self.add_child(form)
+ # Make sure that we don't force a user to
+ # be logged in when visiting the login page!
+ self.check_login = False
+
def do_process(self, session):
if self.logout.get(session):
try:
Modified: branches/stability/wooly/python/wooly/__init__.py
===================================================================
--- branches/stability/wooly/python/wooly/__init__.py 2012-08-06 15:46:10 UTC (rev 5441)
+++ branches/stability/wooly/python/wooly/__init__.py 2012-08-13 16:53:06 UTC (rev 5442)
@@ -114,6 +114,7 @@
self.update_enabled = False
self.defer_enabled = False
self.comments_enabled = True
+ self.check_login = False
# These are computed later in the init pass
self.ancestors = None
@@ -292,7 +293,23 @@
# when a user is not authorized for this widget.
pass
+ def authorized(self, session):
+ login = session.client_session.attributes.get("login_session")
+ if login:
+ when = datetime.now() - timedelta(hours=24)
+ if login.created > when:
+ return True
+ return False
+
def process(self, session, *args):
+ if self.check_login and not self.authorized(session):
+ # redirect to the login page
+ page = self.app.login_page
+ sess = Session(page)
+ page.origin.set(sess, session.marshal())
+ self.redirect.set(session, sess.marshal())
+ return
+
if not self.app.authorize_cb(session, self):
self.redirect_on_not_authorized(session)
else:
@@ -419,6 +436,10 @@
self.profile = self.ProfileAttribute(app, "profile")
self.add_attribute(self.profile)
+ # All pages should only be processed if the user
+ # is logged in, except for the login page, resource, and css.
+ self.check_login = True
+
def init_computed_values(self):
self.ancestors = ()
self.path = ""
Modified: branches/stability/wooly/python/wooly/pages.py
===================================================================
--- branches/stability/wooly/python/wooly/pages.py 2012-08-06 15:46:10 UTC (rev 5441)
+++ branches/stability/wooly/python/wooly/pages.py 2012-08-13 16:53:06 UTC (rev 5442)
@@ -283,6 +283,7 @@
self.html_page = html_page
self.__then = datetime.utcnow()
self.__css = None
+ self.check_login = False
def get_last_modified(self, session):
return self.__then
@@ -378,6 +379,7 @@
self.add_parameter(self.rname)
self.then = datetime.utcnow()
+ self.check_login = False
def get_last_modified(self, session):
return self.then
11 years, 9 months
r5441 - branches/stability/cumin/python/cumin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-08-06 15:46:10 +0000 (Mon, 06 Aug 2012)
New Revision: 5441
Modified:
branches/stability/cumin/python/cumin/objectframe.py
Log:
The merge in revision 5419 included a reference to add_notice which is not
in the branch. Replace with a log message.
Modified: branches/stability/cumin/python/cumin/objectframe.py
===================================================================
--- branches/stability/cumin/python/cumin/objectframe.py 2012-08-02 15:57:23 UTC (rev 5440)
+++ branches/stability/cumin/python/cumin/objectframe.py 2012-08-06 15:46:10 UTC (rev 5441)
@@ -78,7 +78,8 @@
frame.view.show(nsession)
url = nsession.marshal()
self.page.redirect.set(session, url)
- session.add_notice(Notice(message))
+ if message:
+ log.info("Redirecting: " + message)
def do_process(self, session):
# XXX don't process if this frame is invisible
11 years, 9 months
r5440 - trunk/wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-08-02 15:57:23 +0000 (Thu, 02 Aug 2012)
New Revision: 5440
Modified:
trunk/wooly/python/wooly/server.py
Log:
Add handler for OpenSSL.SSL.Error
Modified: trunk/wooly/python/wooly/server.py
===================================================================
--- trunk/wooly/python/wooly/server.py 2012-08-02 15:23:50 UTC (rev 5439)
+++ trunk/wooly/python/wooly/server.py 2012-08-02 15:57:23 UTC (rev 5440)
@@ -261,8 +261,15 @@
pass
try:
+ from OpenSSL import SSL
+ except:
+ class SSL(object):
+ class Error(Exception):
+ pass
+
+ try:
self.wsgi_server.start()
- except SSLError, e:
+ except (SSLError, SSL.Error), e:
log.error("Web server is shutting down from an unhandled SSLError" \
" (problem with the key or certificate?): %s" % e)
self.wsgi_server.stop()
11 years, 9 months
r5439 - in trunk: cumin/bin wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-08-02 15:23:50 +0000 (Thu, 02 Aug 2012)
New Revision: 5439
Modified:
trunk/cumin/bin/cumin-web
trunk/wooly/python/wooly/server.py
Log:
Handle wsgi server thread exceptions with a ERROR level log message
and a shutdown of the thread. Cumin will exit.
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2012-08-01 14:03:04 UTC (rev 5438)
+++ trunk/cumin/bin/cumin-web 2012-08-02 15:23:50 UTC (rev 5439)
@@ -261,6 +261,7 @@
sleep(1)
if not cumin.server_alive():
+ log.info("Web server has stopped, exiting")
print "web server has stopped, exiting..."
log.error("Web server process has stopped")
return_code = CuminErrors.WEB_SERVER_ERROR
Modified: trunk/wooly/python/wooly/server.py
===================================================================
--- trunk/wooly/python/wooly/server.py 2012-08-01 14:03:04 UTC (rev 5438)
+++ trunk/wooly/python/wooly/server.py 2012-08-02 15:23:50 UTC (rev 5439)
@@ -254,8 +254,24 @@
self.wsgi_server.environ["wsgi.version"] = (1, 1)
def run(self):
- self.wsgi_server.start()
+ try:
+ from ssl import SSLError
+ except:
+ class SSLError(Exception):
+ pass
+ try:
+ self.wsgi_server.start()
+ except SSLError, e:
+ log.error("Web server is shutting down from an unhandled SSLError" \
+ " (problem with the key or certificate?): %s" % e)
+ self.wsgi_server.stop()
+
+ except Exception, e:
+ log.error("Web server is shutting down from an unhandled" \
+ " exception: %s" % e)
+ self.wsgi_server.stop()
+
def stop(self):
self.wsgi_server.stop()
11 years, 9 months
r5438 - trunk/cumin/python/cumin/grid
by croberts@fedoraproject.org
Author: croberts
Date: 2012-08-01 14:03:04 +0000 (Wed, 01 Aug 2012)
New Revision: 5438
Modified:
trunk/cumin/python/cumin/grid/dashboard.py
Log:
Changing the title of the usage by accounting group chart.
Modified: trunk/cumin/python/cumin/grid/dashboard.py
===================================================================
--- trunk/cumin/python/cumin/grid/dashboard.py 2012-07-31 02:29:42 UTC (rev 5437)
+++ trunk/cumin/python/cumin/grid/dashboard.py 2012-08-01 14:03:04 UTC (rev 5438)
@@ -93,7 +93,7 @@
class UserUsageChart(ReportingChart):
def render_title(self, session):
- return "Pool usage by user"
+ return "Pool usage by accounting group"
class AccountingChart(ReportingChart):
def render_title(self, session):
11 years, 9 months