(mod_python) - add_handler gives index of dir

Lewis Bergman lbergman at abi.tconline.net
Sat Feb 9 15:39:10 EST 2002


I have posted this to the mod_python list but haven't gotten any ideas yet. I 
wonder if anyone here has worked with mod_python and the publisher?

As indicated, I have used an add_handler statement. This statement, as 
follows, attempts to dynamically change the resultant page viewed by the 
permissions of the user. No errors are reported in the apache log file (which 
is the case if I do something I shouldn't. On execution with a browser I get 
an auth popup like I should, am authed or rejected as appropriate. But 
instead of my expected page I get an index of the directory. Can anyone here 
point me in the correct direction please?

def authenhandler(req):
	"""Provide the correct page for the privilege of user."""

	pw = req.get_basic_auth_pw()
	user = req.connection.user
	if user == "admin" and pw == "admin":
		req.add_handler("PythonHandler", "setup::admin")
		return apache.OK
-------snip rest------------------------------------

The setup.admin is a class in the same directory which contains different 
functions to generate different pages. A part of it follows:

class setup:

	def _frame(frameLeft, frameRight):
		"""Sets up frames.
	
		frameleft and frameright will be replaced by the correct menu function.
		"""
		html = """\
			<html>
			<head>
				<title>ISPMgr</title>
				<link rel=stylesheet type="text/css" href="ispmgr.css" title="stylesheet">
			</head>
			<frameset cols="20%%,*">
				<frame src="%s" scrolling="no" name="menu">
				<frame src="%s" scrolling="no" name="main">
			</frameset>"""% (frameLeft, frameRight)

		return html

	def admin():
		"""Provide all options to admin users."""
		r = _frame('menu.admin', 'main.customer')
		return r
----rest snipped-----------------------------


-- 
Lewis Bergman
Texas Communications
4309 Maple St.
Abilene, TX 79602-8044
915-695-6962 ext 115




More information about the Python-list mailing list