[albatross-users] mod_python / RandomModularSessionApp bug

Paul Hart paulhart at redchocolate.ca
Sun Jun 15 13:00:57 EST 2003


Hi all,

I've just started playing with Albatross; it's been a joy to work with 
so far, and it's allowed me to do some pretty crazy stuff in very few 
lines of code.

I'm having problems with RandomModularSessionApp. My environment is:

OpenBSD 3.3;
Python 2.2.1;
mod_python 3.0.3;
apache 2.0.45.

Unfortunately, when running the app inside mod_python, the following 
stack trace is always generated:

--- START TRACE ---
Template traceback (most recent call last):

Traceback (most recent call last):
   File "/usr/local/lib/python2.2/site-packages/albatross/app.py", line 
143, in run
     self.load_page(ctx)
   File 
"/usr/local/lib/python2.2/site-packages/albatross/randompage.py", line 
28, in load_page
     ctx.redirect(self.start_page())
   File "/usr/local/lib/python2.2/site-packages/albatross/app.py", line 
121, in redirect
     new_loc = self.redirect_url(loc)
   File "/usr/local/lib/python2.2/site-packages/albatross/app.py", line 
113, in redirect_url
     return urlparse.urlunparse(('http', self.request.get_servername(),
   File "/usr/local/lib/python2.2/site-packages/albatross/apacheapp.py", 
line 34, in get_servername
     return self.__req.connection.server.server_hostname
AttributeError: server
--- END TRACE ---

The problem is that, as of mod_python 3.0.3 (at least), there is no 
'server' member inside the connection object. Instead, all that exists 
is the 'base_server' member. This is no good to me though; I'm running 
on a machine with several virtual hosts, and base_server returns what 
it considers to be the default virtual host, which isn't the one that 
I'm working with.

I don't know if there is a fix; I'm very new with Python, and have no 
real understanding of the coding behind mod_python, apart from being 
able to hack at Albatross enough to prove that base_server wasn't what 
I was looking for (if it had been, I would have submitted some kind of 
patch), and finding out that the os.environ items in mod_python are 
completely useless to me ;)

If anyone has a suggestion (that isn't "use CGI" ;), I'd appreciate it.

Thanks,

Paul Hart




More information about the Albatross-users mailing list