[Medusa-dev] unix_user_handler bug fixed

SergioFernández sfmunoz@teleline.es
Sun Nov 24 16:56:09 2002


Hello:

This is a little patch that makes 'unix_user_handler' to work properly
in Python 2.2 (SuSE 8.0). The error exists in 0.5.2, 0.5.3 and CVS (Nov
22, 2002) versions.

The problem is in handle_request (class unix_user_handler, file
unix_user_handler.py). When I tried to use this handler, I got the
following error:

error: Server Error: exceptions.AttributeError, group: file: /usr/lib/python2.2/site-packages/medusa/unix_user_handler.py line: 38
192.168.0.1:1050 - - [24/Nov/2002:16:43:24 +0100] "GET /~user/ HTTP/1.0" 500 311

To fix this error you can apply the following patch:

diff -urN medusa-0.5.3.orig/unix_user_handler.py medusa-0.5.3/unix_user_handler.py
--- medusa-0.5.3.orig/unix_user_handler.py	Tue Mar 19 23:49:35 2002
+++ medusa-0.5.3/unix_user_handler.py	Sat Nov 23 18:46:02 2002
@@ -35,13 +35,13 @@
 
     def handle_request (self, request):
         # get the user name
-        user = user_dir.group(1)
-        rest = user_dir.group(2)
+        m = user_dir.match (request.uri)
+        user = m.group(1)
+        rest = m.group(2)
 
         # special hack to catch those lazy URL typers
         if not rest:
-            request['Location'] = 'http://%s/~%s/' % (
-                    request.channel.server.server_name,
+            request['Location'] = '/~%s/' % (
                     user
                     )
             request.error (301)

Pay special attention: this patch fixes two problems. The first one is that
explained in this e-mail. The second one fixes a little problem in
request['Location'] calculation. The old method gave me some problems too.
With this patch, that problem has been fixed (I think the new way to
calculate request['Location'] is a better one).

Sergio



More information about the Medusa-dev mailing list