Graham Dumpleton
graham.dumpleton at gmail.com
Tue Dec 30 21:48:34 EST 2008
Log values of: req.filename req.uri req.path_info req.args In the handler and post so can see better what you are saying is getting passed to it. Unless you are saying publisher isn't getting the request at all. Graham 2008/12/31 Clodoaldo Pinto Neto <clodoaldo.pinto.neto at gmail.com>: > I'm working on an old mod_python-publisher site. I'm changing the > current query string parameters to dynamic urls using mod_rewrite > inside a virtual host. > > <Directory /var/www/html/example.com> > SetHandler mod_python > PythonHandler /home/example/mod/_publisher.py > PythonOption mod_python.importer.path "['/home/example/mod']" > PythonFixupHandler /home/example/mod/_upload_limit.py > </Directory> > > RewriteLog /var/log/httpd/example.com-rewrite.log > RewriteLogLevel 9 > RewriteEngine on > RewriteRule ^/pub/.* - [L] > RewriteRule ^/$ /index.py [L] > RewriteRule ^/(.*?)/?$ /$1/ > RewriteRule ^(/(a|b|c))?([/\w]+?)(/(\d+))?/$ $3/?tv=$2&pagina=$5 [NC] > RewriteRule ^([/\w]*?)(/(x|y|z))?(/(\w+?))?(/(\w+?))?/$ \ > $1/?uf=$3&localidade=$5&bairro=$7 [QSA,NC] > RewriteRule ^(/(\w+))?(/(\w+))?/$ /?marca=$2&modelo=$4 [QSA] > RewriteRule ^/$ /index.py [QSA,L] > > > The rewrite is working as expected. The problem i have is the > publisher doing its own rewrite (is it?) after the one above using the > original uri not the rewrote one. > > rewrite log: > > 10.1.1.101 - - [30/Dec/2008:23:28:45 --0200] > [example.dkt/sid#b94e66e0][rid#bedec338/initial] (3) split > uri=/?marca=&modelo= -> uri=/, > args=marca=&modelo=&uf=DF&localidade=Sao_Paulo&bairro=&tv=a&pagina=2 > 10.1.1.101 - - [30/Dec/2008:23:28:45 --0200] > [example.dkt/sid#b94e66e0][rid#bedec338/initial] (3) applying pattern > '^/$' to uri '/' > 10.1.1.101 - - [30/Dec/2008:23:28:45 --0200] > [example.dkt/sid#b94e66e0][rid#bedec338/initial] (2) rewrite '/' -> > '/index.py' > 10.1.1.101 - - [30/Dec/2008:23:28:45 --0200] > [example.dkt/sid#b94e66e0][rid#bedec338/initial] (2) local path > result: /index.py > 10.1.1.101 - - [30/Dec/2008:23:28:45 --0200] > [example.dkt/sid#b94e66e0][rid#bedec338/initial] (2) prefixed with > document_root to /var/www/html/example.com/index.py > 10.1.1.101 - - [30/Dec/2008:23:28:45 --0200] > [example.dkt/sid#b94e66e0][rid#bedec338/initial] (1) go-ahead with > /var/www/html/example.com/index.py [OK] > > Then the publisher gets from there with the original uri: > > 10.1.1.101 - - [30/Dec/2008:23:28:45 --0200] > [example.dkt/sid#b94e66e0][rid#beac0170/initial] (2) init rewrite > engine with requested uri /a/DF/Sao_Paulo/ > > How to make the publisher use the rewrote uri? Or what am i missing > and should be doing? > > _publisher.py: > > from mod_python import publisher > from os.path import basename > > def handler(req): > req.add_output_filter('DEFLATE') > if basename(req.filename) == 'index.py': > req.uri = '/' > return publisher.handler(req) > > Regards, Clodoaldo > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python >
|