We're using twisted.web.xmlrpc to serve an xmlrpclib client, so
We'd like to pass None through the rpc connection on occasion. There's
a flag in the standard lib to allow this to serialize ( send
allow_none=True to the xmlrpclib.Server() )
We're getting this error from the twisted resource when we try to
Fault: <Fault 8002: "can't serialize output">
I know that the twisted resources uses the stock xmlrpclib, but how
can we tell it to allow None to serialize the twisted way?
I'm Lloyd, I'm baffled, and I'd like to offer my modest talents to help
others like me come up to speed with Twisted.web in record time.
I've been looking for a way to bring a large ColdFusion application over
to Python. Twisted.web looks to offer all that I could wish for and more.
The work to date is awe-inspiring. But... the documentation,
well-intentioned as it is, and much more ample than in many Open Source
projects, truly baffles me.
I'm first to admit my limitations: I'm still in the early learning stages
of Python; I understand OO conceptually, but have little experience
writing or reading OO code; and, approaching the golden years, undoubtably
have far fewer functioning neurons than most of the subscribers to this
list, much less the brilliant young turks who have created the Twisted
But, browsing through the archives, it's clear that I am not alone in my
So, I'd like to make a proposal:
I have many years of writing and editing experience. Back in the days when
personal computers were still connected to audio cassette recorders, and I
was as excited but unenlightened about PCs as I am now about Twisted, I
contributed three well-received articles to Personal Computing magazine
under the name Techo Turkey. These helped readers hook up IBM Selectric
Terminals to their new PCs, create a computer-controlled haunted house for
Halloween, and set up a computer-controlled home security system.
I would like now to offer to write some supplementary documentation for
Twisted.web aimed at turkeys like me -- the really really basic stuff plus
sure-to-work examples that can bring even Mickey-the-Dunce to sufficient
level of understanding that he can participate creatively in the Twisted
The catch: I need knowledgeable folks willing to answer my many many
stupid questions like, once you've installed Twisted from, say, Debian,
where should what files go and how should permissions be defined?
Undoubtably these generous mentors would also need to critique my newbie
code and perhaps, even, submit examples of their own. Who know, maybe we
could even get a book out of it.
For the Nevow-based application I'm coding, I want to have a
standardized layout with a header and footer. The layout needs to be
implemented as an object, so that a new one can be swapped in without
having to change the code.
A simplified version of the code I'm using looks like this:
docFactory = loaders.xmlstr('''
<nevow:invisible nevow:data="body" nevow:render="data"/>
def data_body(self, context, data):
docFactory = loaders.xmlstr('''
<html xmlns:nevow="http://nevow.com/ns/nevow/0.1" nevow:render="withLayout">
def render_withLayout(self, context, data):
This works fine for a simple static page like the one in the example,
but if I add nevow:render="foo" to an element in the page, it gets
looked up as as Layout.render_foo instead of as Resource.render_foo.
I can fix that by making Resource.render_withLayout call flatten() on
the page's body, but that causes Deferred data to stop working. Is
there a better approach?
I have looked through the examples and the archives but cannot find what
I am looking for.
I need to be able to create a piece of HTML that is updated once a
second via livepage.
currently my html looks like
<span class="time"><nevow:slot name="time" /></span>
and the python looks like
def render_time(self, context, data):
context.fillSlots('time', '%s' % time.ctime())
but I need to refresh the browser to update the time - can anyone point
me in the right direction so that the time is constantly updated?
This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
I just thought that I would make a little project announcement about
something I've been tinkering with for the past week or two.
NuFox is a server-side XUL toolkit written on top of nevow. It uses a
customised stan dialect with xml namespace support as well as livepage
(nevow svn head version), and then abstracts that all away into a more
Its very early in development but its already pretty powerful in terms
of what you can do with it, check it out and play with some of the
examples. Feedback is most welcome.
I have my xmlrpc class that I am running in twisted. I want it to do some
cleaning up when it is finished, and so I have defined a custom __del__
However, when mixed with a looping call, it never gets called. Sample code
below. Remove the two lines starting with self.looping, and it all works as
expected. Put them in, and the custom __del__ is not called.
Is this a bug in twisted? Or have I broken some twisted rule about using
__del__ procedures? Is there some other way of saying 'when you have stopped
the reactor, do foo', that twisted would be happy with?
Any suggestions welcome. :-)
from twisted.web import xmlrpc
from twisted.internet import reactor, task
print 'Init class Hello'
# the following two lines cause the custom __del__
# function to never be called
self.looping = task.LoopingCall(self.foo)
print 'Tidy up class Hello'
"""Return 'hello, world'."""
return 'hello, world!'
return 'Shutting down server'
from twisted.web import server
r = Hello()
reactor.listenTCP(7080, server.Site(r), interface = '127.0.0.1')
if __name__ == '__main__':
Melbourne, Australia (UTC +10 hrs)