r5442 - in branches/stability: cumin/python/cumin/account wooly/python/wooly
tmckay at fedoraproject.org
tmckay at fedoraproject.org
Mon Aug 13 16:53:07 UTC 2012
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
More information about the cumin-developers
mailing list