[Twisted-Python] The problem with Twisted...
Philippe Lafoucrière
lafou at wanadoo.fr
Thu Jun 5 03:28:06 MDT 2003
> I'm no Woven expert, but wvupdate_ is described here:
> http://twistedmatrix.com/documents/howto/viewindepth#auto5
>
> I presume you're saying that's not clear enough?
>
> (I really should try to learn Woven myself sometime, so I can know how you
> feel... :)
Yes, Please try it. I a twisted newbie, but sometimes things happen
magically. I knew the page
howto/viewindepth#auto5
(red all the doc already) but this is not clear enough for me (maybe
it's because I'm not english fluent). For me, wvupdate_ and wvfactory_
are used to create a new View for a page.Page.
In exemples :
-----------------------------------------------------------------
class MyPage(page.Page):
def wvupdate_foo(self, request, widget, data):
if data > 10:
newNode = widget.getPattern("large")
else:
newNode = widget.getPattern("small")
newNode.appendChild(request.d.createTextNode(str(data)))
widget.appendChild(newNode)
-----------------------------------------------------------------
class MyView(view.View):
def generate(self, request, node, model):
return request.d.createTextNode("Hello, world!")
class MyPage(page.Page):
def wvfactory_foo(self, request, node, model):
return MyView(model)
-----------------------------------------------------------------
I think I can put :
****
if data > 10:
newNode = widget.getPattern("large")
else:
newNode = widget.getPattern("small")
newNode.appendChild(request.d.createTextNode(str(data)))
widget.appendChild(newNode)
****
in the wvfactory_foo !?
==================================================================
By the way, I was looking for documentation on cred, since I want to
persist identies created on a twisted server. The cred howto needs some
rewrite with concrete exemples.
I can't pickle identities with Shelf since Indenties have references to
Auth, and Auth to Identities (infinite loop when pickeling).
--
Philippe Lafoucrière <lafou at wanadoo.fr>
InFuzzion
More information about the Twisted-Python
mailing list