[mod_python] get post to a class

maker joe makerjoe at gmail.com
Fri Jun 22 02:38:40 EDT 2007


hi graham
you said:
> I don't see how that will work at all. At least not if you are using
> publisher.

im using publisher and it works, so now im confused
but

for
 So, maybe you should explain in english what you expect to happen.
>

anyway all these question were about using modpython to develope a
module driven application (not generator)  were the system gets
distinct behaviours as per what module has to be imported from data
modified on a master database (mysql),  and nothing else

thank you in advance for all your input
joseluis


On 6/21/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote:
> On 22/06/07, maker joe <makerjoe at gmail.com> wrote:
> > perhaps a little bit simpler would be
> >
> > go.py
> > -------
> > import myclasses
> > c=dispatch()
> > c.message(req)
> >
> > myclasses.py
> > --------------------
> > class dispatch:
> >     def message(self,req)
> >          req.write('hello %s'%req.form['name'])
> >
> > http://localhost/my.py/go?name=joe
>
> I don't see how that will work at all. At least not if you are using
> publisher. If you have instead written your own handler which performs
> its own URL dispatch then maybe it may work, but I don't know how your
> dispatcher works.
>
> If I try and read into your code as to what you perhaps meant, there
> is a big difference in that with the approach I was suggested, there
> would be a separate instance of the class per request. In your code,
> by creating the instance at global scope within the module there will
> be one instance for the life of the process and all requests will be
> handled within that once instance. The consequences of using a single
> instance are that class attributes can't be used for transient data
> for a single request where one wants to use that as a means of
> communicating data between member functions.
>
> What you really need to do is explain what behaviour you want. One
> class instance to be used for all requests, or one per request. For
> all I know, all you were perhaps after was to know how to make a URL
> traverse into objects, but your URL examples haven't been suggestive
> of that.
>
> So, maybe you should explain in english what you expect to happen.
>
>
>
> Graham
>
> > On 6/21/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote:
> > > On 22/06/07, maker joe <