[Twisted-Python] Woven View factories: defered rendering?

Philippe Lafoucrière lafou at wanadoo.fr
Thu Nov 20 05:04:31 EST 2003


Same problem here, and I didn't find a solution. This should to the woven faq 
I think.

On Thursday 20 November 2003 04:20, Michal Pasternak wrote:
> Hi,
>
> I have a webpage, that is rendered via twisted.web.woven.page.Page class.
>
> In one of it's wvfactory_ methods, I need to send an e-mail. I would also
> like to check if sending of the e-mail was successful (eg. mailserver is
> up, running, and reachable via network).
>
> I thought about something like this:
>
>   def wvfactory_render(self, req, node, model):
>       # do some stuff
>       sendEMail().addCallbacks(self.emailOkay, self.emailFailure)
>       return # what should I return here?
>
>   def emailOkay(self, *args):
>       # render "thank you, e-mail sent" message
>
>   def emailFailure(self, *args):
>       # render "error" message
>
> My questions:
>    1) is it a good, Twisted Python way to do this? If not,
>       a) what would be the correct one?
>       b) can you point me to some docs?
>    2) if it is a good way:
>       a) is it implemented? if yes:
>       	 1) what should I return from wvfactory_render?
> 	 2) what parameters would be passed to callbacks then?
>       b) if not, do you think it would be worth implementing?
>
> I have seen something similar like the thing I want to code in some example
> sources:
>
>        def render(...):
>        	   [ launch some callbacks ]
> 	   return server.NOT_DONE_YET
>
> ... but they were about Resource class, and I'm using Page here.
>
> Anyone?
>
> Regards,





More information about the Twisted-Python mailing list