quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S├ębastien Arnaud <arnau...@emedialibrary.org>
Subject Regex based publisher proposal
Date Thu, 07 Sep 2006 04:59:03 GMT

I have been following with passion mod_python development for quite a  
while now, and in the light of a few emails over the past few months  
discussing web frameworks in mod_python, I decided I would attempt to  
contribute to the project in order to move towards a fast, flexible  
MVC mod_python only based web framework.

I have written 2 or 3 different ones along the past couple of years,  
but nothing worthy of sharing by any mean. They have helped me  
however to define what would be the "dream" web framework for  
mod_python, but more importantly to identify the needed plumbing  
improvements to mod_python.

One of the first needed improvements, in my opinion, is the capacity  
to route web requests in a more flexible manner than via the current  
publisher module. So, I would like to propose the following module  
(pubre.py). It is basically a copy of the mod_python.publisher module  
to the exception that a lot of the core handler code has been  
modified to use regex in order to route a web request to the  
appropriate module/function.

I have been developing against mod_python/trunk and I attached the  
file for whoever wants to review it and give it a try. Keep in mind  
though it is still probably rough around the edges and not any solid  
testing has been performed yet. I only performed some trivial  
benchmarking/stress testing to make sure that performance wise it was  
on par with the current mod_python.publisher.

The default behavior is suppose to be 100% compatible with the way  
mod_python.publisher behaves. Eventually though you would be able to  
pass as a PythonOption the grammar of the urls in your web  
application, by simply declaring something like:

<Directory "/mypath/mydir/">
	AddHandler mod_python .py .html
	PythonHandler mod_python.pubre
	PythonOption "pubregex" "(?P<controller>[\w]+)?(\.(?P<extension>[\w] 

I know that not all grammars will work with the current version  
attached (due to some code being still dependent on the conservative  
url structure /path/file.ext), eventually though, I hope I can get  
this solved and allow any regex grammar to work.

Anyway, please share your comments and feedback to make sure I am  
headed in the right direction by keeping in mind that my first goal  
is to be able to publish using a defined regex url grammar a callable  
class within a module. I believe that once this first step is  
accomplished the real design of the web framework can begin.



View raw message