On Mon, Apr 9, 2012 at 7:58 PM, Graham Dumpleton
<[email protected]> wrote:
> On 9 April 2012 21:03, Joonas Lehtolahti <[email protected]> wrote:
>> The only place where you do increase counter is in __init__ and you do it
>> only right after setting counter to 0. So counter will always be 1, no
>> matter what. Perhaps you should move self.counter += 1 to __call__ method?

You're right. Now the counter is incremented on each request. Thanks
for pointing out.

> Which will not help unless also move:
>
> self.out = []
> self.out.append(str(self.counter))
>
> to the __call__ method.
>
> Having:
>
> php.printx("hello world")
>
> at module scope is also wrong.
>
> The basic misunderstanding here is probably the belief that the whole
> contents of the file are executed on each script when they aren't.
>
> The script is only loaded once for the life of the process and then on
> each request the application callable is called. In this case the
> __call__() method.

Yeah, running it with AddHandler definitely has corrupted what I'd
already understand about mod_wsgi. Also realized that php.printx() is
useless since the only way to get request data is through something
that being called from __call__() method. The idea I have in mind now
is to have __call__() parse the path_info, look for something like
/index.py/page.mako in ./htdocs, process it with mako and return the
result from mako but I guess it too silly to proceed now.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to