[mod_python] Getting request object

Graham Dumpleton grahamd at dscpl.com.au
Mon Dec 5 18:27:16 EST 2005

Radek =?iso-8859-2?q?Barto=F2?= wrote ..
> instead of classic usage:
> ....
> def index(req)
>    instance = MyClass()
>    ....
> because you can access each class method by typing URL (i. e. 
> http://hostname/file/index/method1) or you can access object itself (i.
> e. 
> http://hostname/file). The problem is that when you use second way you
> can't 
> pass request object in class's constructor. Is there any posibility how
> to 
> get request object in class's constructor or in global scope?

I maybe don't understand what you are asking, but why can't you do:

  def index(req):
    instance = MyClass(req)

This is presuming that you are creating an instance of MyClass for each


More information about the Mod_python mailing list