Author: justi9
Date: 2008-10-09 13:11:04 -0400 (Thu, 09 Oct 2008)
New Revision: 2610
Modified:
mgmt/trunk/cumin-test-0/etc/cumin.conf
mgmt/trunk/cumin/python/cumin/__init__.py
Log:
To save us all some typing, automatically log in the guest user in the devel environment
Modified: mgmt/trunk/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/__init__.py 2008-10-09 14:46:28 UTC (rev 2609)
+++ mgmt/trunk/cumin/python/cumin/__init__.py 2008-10-09 17:11:04 UTC (rev 2610)
@@ -16,7 +16,7 @@
from page import MainPage
from stat import StatChartPage
from action import ActionPage
-from user import LoginPage
+from user import LoginPage, UserSession
from wooly import Session
@@ -157,6 +157,18 @@
return True
+ if self.app.config.user:
+ user = Subject.getByName(self.app.config.user)
+
+ assert user
+
+ usess = UserSession(self.app, user)
+ session.set_cookie("session", usess.id)
+
+ page.set_redirect_url(session, session.marshal())
+
+ return False
+
lpage = self.app.login_page
lsess = Session(lpage)
lpage.origin.set(lsess, session.marshal())
@@ -197,6 +209,8 @@
param = ConfigParameter(self, "debug", bool)
param.default = False
+ param = ConfigParameter(self, "user", str)
+
def init(self):
super(CuminConfig, self).init()
Modified: mgmt/trunk/cumin-test-0/etc/cumin.conf
===================================================================
--- mgmt/trunk/cumin-test-0/etc/cumin.conf 2008-10-09 14:46:28 UTC (rev 2609)
+++ mgmt/trunk/cumin-test-0/etc/cumin.conf 2008-10-09 17:11:04 UTC (rev 2610)
@@ -1,2 +1,3 @@
[main]
debug: True
+user: guest