[Zope3-Users] feedback while asking response

Roger Ineichen dev at projekt01.ch
Thu Apr 14 04:09:10 EDT 2005


Hi Markus

From: Markus Leist [mailto:ml_zope3_dev at ikom-online.de] 
> Sent: Thursday, April 14, 2005 8:58 AM
> To: zope3-users at zope.org
> Cc: Stephan Richter; dev at projekt01.ch
> Subject: RE: [Zope3-Users] feedback while asking response
> 
> Hmm,
> in which way this interacts with an application-class?
> 
> It's not a change of any zope-intern class, or?

I don't understand this. What do you mean with a 
application class?


> i.e. my test-class is:
> ----------------------------------------
> class adm:
>     def admTestOut( self):
>         """
>         test for "online-feedback"
>         """
>         response = self.request.response
>         response.write( "1111")
>         time.sleep(10)
>         response.write( "2222")
> ----------------------------------------



> snip on configure.zcml:
> ----------------------------------------
>   <page
>       name="admtestout"
>       for="ikom.ikgen.interfaces.IIkGen"
>       class=".ikgen.adm"
>       permission="ikom.ikgen.Edit"
>       attribute="admTestOut" />
> ----------------------------------------
> 
> Ok, this does not work, a cleary case:
> the response will display "11112222"
> after 10s.

Hm, Are you sure the response get send after 10s
to the client or does the client only render the page if 
the response ends. 
Can you use TCPWatch for trace the response from the server?

> In which way, I have to integrate a
> View-Class and the _call_-method to
> my application?

Do you mean how the view class get called?

The view class uses a base in the configure directive class 
where get mixed in. This base class uses the __call__ method 
for call a page template, if you use a template attribute.

If you use a attribute "attribute", like you use in your example,
this attribute is mapped to the __call__ method during the 
registration.

If you traverse to a view, the view get called with the 
__call__ method and the method __call__ calls your attribute 
or the page template (ViewPageTemplate) for rendering the page.

Regards
Roger Ineichen

> Thanks for help
> 
> Markus
> 
> Am Mittwoch, 13. April 2005 16:32 schrieb Stephan Richter:
> [...]
> > You can do this by directly writing to the response and not 
> returning
> > anything through the executing method:
> >
> > class View(object):
> >
> >   def __call__(self):
> >     response = self.request.response
> >     # ... set all necessary headers
> >     response.write(data)
> >    sleep(10)
> >     response.write(data)
> >    sleep(10)
> >    response.write(data)
> >
> [...]
> 



More information about the Zope3-users mailing list