I have a very strange problem. I have two Solaris machines that have the
python2.5 + cherrypy installed. I have wrote a program that uses the
cherrypy as web service. GUI is working just fine on both machines. The only
thing that is different when I'm trying to login into a password protected
web pages. In one machine the HttpRedirect function works as expected and on
the other one returns to the login page.
I have installed the faulty machine again with the same installation CD and
gave it the same IP address. Both configurations are identical. I'm just
moving the lan cable from one machine to another and the problem is still
there.
I have installed another machine (same hardware) and it happened again. The
only thing that had left to do is to reinstall the machine that is working.
The code looks like this:
def login(self, failed = False, referer=""):
cherrypy.session[LOGIN] = None
tmpl = login.login(searchList=[{
"version" : self.version,
"timeFormat" : self.timeFormat,
"failed" : failed,
"referer" : referer
}])
return str(tmpl)
login.exposed = True
def authLogin(self, signIn=None, password=None, referer=""):
if password:
if password == self.password:
cherrypy.session[LOGIN] = AUTHENTICATED
raise cherrypy.HTTPRedirect("/%s" % referer)
else:
raise cherrypy.HTTPRedirect("/login?failed=True&referer=%s"
% referer)
else:
raise cherrypy.HTTPRedirect("/login?failed=True&referer=%s" %
referer)
authLogin.exposed=True
def status(self):
user = cherrypy.session.get(LOGIN)
statDict = self.daemon.statusInterface.getStatusForGUI()
errors = statDict[DaemonConsts.MAIN_ERROR_MSG]
activeRole, activeName, activeColor, activeStatus =
statDict[DaemonConsts.ACTIVE_DBS_DETAILS]
stdbyRole, stdbyName, stdbyColor, stdbyStatus =
statDict[DaemonConsts.STDBY_DBS_DETAILS]
repServerName, repServerColor, repServerStatus =
statDict[DaemonConsts.REP_SERVER_DETAILS]
tasks = statDict[DaemonConsts.RUNNING_TASKS]
sysMessages = statDict[DaemonConsts.SYSTEM_MESSAGES]
sysCounters = statDict[DaemonConsts.SYSTEM_COUNTERS]
###
tmpl = status.status(searchList=[{
"user" : user,
"referer" : "status",
"refreshRate" : self.refreshRate,
"version" : self.version,
"timeFormat" : self.timeFormat,
"activeDbsColor" : self._int2color(activeColor),
"replicationServerColor" : self._int2color(repServerColor),
"standbyDbsColor" : self._int2color(stdbyColor),
"activeDbsHost" : activeName,
"replicationServerHost" : repServerName,
"standbyDbsHost" : stdbyName,
"errors" : errors,
"tasks" : tasks,
"sysCounters" : sysCounters,
"sysMessages" : sysMessages
}])
return str(tmpl)
status.exposed = True
def replication(self, actionStatus = True, message = ''):
if not cherrypy.session.get(LOGIN) == AUTHENTICATED:
raise cherrypy.InternalRedirect("/login?referer=replication")
###
user = cherrypy.session.get(LOGIN)
statDict = self.daemon.statusInterface.getStatusForGUI()
activeRole, activeName, activeColor, activeStatus =
statDict[DaemonConsts.ACTIVE_DBS_DETAILS]
stdbyRole, stdbyName, stdbyColor, stdbyStatus =
statDict[DaemonConsts.STDBY_DBS_DETAILS]
repServerName, repServerColor, repServerStatus =
statDict[DaemonConsts.REP_SERVER_DETAILS]
tasks = statDict[DaemonConsts.CONTROL_TASKS]
stopStartBtn = statDict[DaemonConsts.STOP_START_BUTTON]
suspendResumeBtn = statDict[DaemonConsts.SUSPEND_RESUME_BUTTON]
terminateRebuildBtn =
statDict[DaemonConsts.TERMINATE_REBUILD_BUTTON]
switchFailoverBtn = statDict[DaemonConsts.SWITCH_FAILOVER_BUTTON]
###
tmpl = replication.replication(searchList=[{
"user" : user,
"referer" : "replication",
"refreshRate" : self.refreshRate,
"version" : self.version,
"timeFormat" : self.timeFormat,
"repStatusMessage" : self._int2dbStatus(repServerStatus),
"activeDbsHost" : activeName,
"standbyDbsHost" : stdbyName,
"stopStartBtn" : stopStartBtn,
"suspendResumeBtn" : suspendResumeBtn,
"terminateRebuildBtn" : terminateRebuildBtn,
"switchFailoverBtn" : switchFailoverBtn,
"tasks" : tasks,
"actionStatus" : actionStatus,
"message" : message
}])
return str(tmpl)
replication.exposed = True
authLogin works fine till the HttpRedirect("/%s" % referer) function.
replication function is a login page's function. status function is a
regular page's function. The problem is between the HttpRedirect function
and cherrypy.session.get(LOGIN) function in the replication function.
Please let me know if you need anymore information.
Thanks
Gil
--
View this message in context: http://www.nabble.com/problem-entering-a-login-requiered-page-tp20419467p20419467.html
Sent from the cherrypy-devel mailing list archive at Nabble.com.
Thanks anyway
--
View this message in context: http://www.nabble.com/problem-entering-a-login-requiered-page-tp20419467p20436261.html
Thank you for providing the feedback.
- Sylvain
eranlevi a écrit :