[albatross-users] mod_python / RandomModularSessionApp bug

Paul Hart paulhart at redchocolate.ca
Sun Jun 15 13:32:34 EST 2003


Whoops, so I spoke too soon; I think I have a solution.

in apacheapp.py line 33, change the following:

     def get_servername(self):
         return self.__req.connection.server.server_hostname

into the following:

     def get_servername(self):
         try:
             return self.__req.connection.server.server_hostname
         except:
             return self.__req.hostname

That appears to be working for me. Maybe that's been fixed in 1.10pre1;  
because I want to work with release software, I haven't checked.

Hope that helps!

Paul

On Saturday, June 14, 2003, at 11:00  PM, Paul Hart wrote:

> 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
>
> _______________________________________________
> Albatross-users mailing list
> Albatross-users at object-craft.com.au
> https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross- 
> users




More information about the Albatross-users mailing list