[mod_python] Pre and postprocess blocks (Publisher mode)?

durumdara durumdara at gmail.com
Fri May 4 04:12:03 EDT 2007


Hi!

I tried Pylons to see and check it... how to working, what I need to 
learn about it... from it... :-)

http://groups.google.com/group/pylons-discuss/browse_thread/thread/8870ed10d821c06f

I probably ported my modpy site to pylons-type site.

One thing I like in it: it have preprocess, and postprocess phase where 
I define the common operations.

Example: session, database handling, right/access checking, etc.

So pylons is starts with _before_ procedure, what defined in base 
controller and "overrideable" in any controllers; and next it is 
traverses the path to controller/action.
Then it is calls the actual "controller object"'s actual function (named 
as action). This procedure is get back a Response object.
Finally it is call the _after_ procedure, and finished with request.

Because the controllers are python modules, it is avoid the "same module 
name" hell (in another modules I can use same name - example index).

I know that modpy supports publisher mode, that same like pylons' 
working method.

1.)
But I want to know: how the modpython helps me to I do pre- and 
postprocess operations?

2.)
Can I get paths/pages without extensions like in pylons?
Example:
www.somesite.com/main
www.somesite.com/search
And not:
www.somesite.com/main.py
www.somesite.com/search.py

In publisher mode how the paths are working?
When I have a module named main.py that have many subfunctions, what 
path I need to use?
www.somesite.com/main.py/index
www.somesite.com/main.py/search
or
www.somesite.com/main/index
www.somesite.com/main/search
?

Please help me a little!

Thanks for it!
  dd





More information about the Mod_python mailing list