hi there, folks:
I'd really like to release 0.7.0 but I would like it to be at least a
little bit tested before I do so. Could those of you with CVS trees check
everything out and see if it performs as advertised? Deeper bugs than
that will have to wait for the next release, but I'd at least like to know
if it works for someone other than me.
______ __ __ _____ _ _
| ____ | \_/ |_____] |_____|
|_____| |_____ | | | |
@ t w i s t e d m a t r i x . c o m
I have an xml file in my application,
I have created an element using
Example goes like this.........
and i appeneded it by using append() method.
But how i can reflect this change to my xml file?
and one more thing is i want to create element with some other parameters....
<abc m=" " n=" ">
and i have m and n values as strings with me.
can anybody help me to create this element and write it to the existing xml file
as a child of an existing element?
Thanks in advance..
Forgot the famous last words? Access your message archive online at http://in.messenger.yahoo.com/webmessengerpromo.php
On 18 May 2004, the following message was posted to this mailinglist:
Jp Calderone exarkun at divmod.com wrote:
>Daniel Newton wrote:
> I have a simple XML-PRC server similar to the example below:
> from twisted.web import xmlrpc, server
> class Example(xmlrpc.XMLRPC):
> """An example object to be published."""
> def xmlrpc_add(self, a, b):
> """Return sum of arguments."""
> return a + b
> if __name__ == '__main__':
> from twisted.internet import reactor
> r = Example()
> reactor.listenTCP(7080, server.Site(r))
> I want to be able to get the address of the client that calls the
> method can anyone help me with this?
This solution didn't work because 'transport' isn't a property of the
I'm currently in the process of changing from a customized
SimpleXMLRPCServer to a twisted XMLRPC server solution and I need to
insert the client IP into the attributes passed to the called xmlrpc
method. Anyone who knows the answer and is willing to share the info?
I have a sample XMPP client with the following structure:
from twisted.words.protocols.jabber import client, jid
from twisted.internet import reactor
factory = client.basicClientFactory(myJid, myPasswd)
It works well, I can connect to the XMPP server. But I would appreciate
if some one could give me some hints on what's required to get the
client to connect using a secure SSL link.
I am currently working on writing an application using the twisted
framework. The problem that I have is that I do not want to use twistd.
In fact, I find twistd to be inappropriate as it defaults pidfile and
logfile to something specific to twisted, not my application, and it
seem completely silly to have to pass in -pidfile and -logfile params
when stating it up. Those parameters should be specified as part of the
Application object itself, and should allow for CLI override. Further,
as I want my daemon that I'm writing to look and act like a daemon
(UNIX), I do not want to be invoking some general "twistd" command and
passing a ton of options. Ideally, I should be able to write a Pythons
script that acts like twistd, but can bake in default options and
hide/expose other ServerOptions as I so see fit.
For example, if I run,
It should fire up the daemon
should dump the help
should all function accordingly. I want to avoid all of this "twistd -y"
business, as the daemon, isn't "twistd" it's my code. I should be able
to use the ApplicationRunner, UnixApplicationRunner, etc "runners",
however, as they are currently written, they are twistd specific. For
example, in 8.2, the def checkPid function bakes in, "
Another twistd server is running, PID %s\n
This could either be a previously started instance of your application
different application entirely. To start a new one, either run it in
directory, or use the --pidfile and --logfile parameters to avoid
""" % pid)"
Which is iditic as my application may not even expose a -pidfile or a
-logfile and it's definatley not called twistd. The platform specific
application runners need to be more generalized so users can write their
own twistd equivalent to include only what they want.
Perhaps I'm missing some key point of twisted that already does this. If
so, I'd love to be guided in the right direction. If not, and I've got a
valid point here, I'd love to know how I can help to remedy this
problem. I think it's great that twistd provides application management
classes, but they are unnecessarily intertwined with twistd which should
be completely optional.
First let me introduce a piece of software I have written using
Twisted: it's called dfd_keeper, and is a BSD/pf port of a generic
concept I invented called the dynamic firewall daemon.
If you like the concept, please promote the idea; I think it's neat
but there hasn't exactly been a groundswell of interest in it.
In essence, it allows you to netcat or telnet to the daemon process
and issue text-like commands that alter your firewall rules. You can
think of it as a "shell" for the firewall, and it can do neat things
like create firewall rules that expire automatically after a period of
time and so on.
The problem I'm having is this; I upgraded my firewall from OpenBSD
4.2 or so to OpenBSD 4.5, and now I'm working with newer versions of
all the software including Twisted.
The program works fine normally, and can run in the background, but if I
invoke a daemonize() routine that turns it into a network daemon, it
refuses to serve incoming TCP connections. Actually the TCP connection
is made, but the software never responds to it.
Specifically, my twisted.internet.protocol.Factory instance is created,
but buildProtocol is never called.
Before I dive deeply into debugging the software, I thought I'd ask if
anyone knew off the top of their head any reason why Twisted might not
act the same if it was daemonized (no controlling terminal, no
stdin/out/err, forked as a background process).
Obama Nation | My emails do not have attachments; it's a digital signature
that your mail program doesn't understand. | http://www.subspacefield.org/~travis/
If you are a spammer, please email john(a)subspacefield.org to get blacklisted.
Was able to isolate and confirm that the real issue is that login is hanging
for some reason, and causing the timeout message. I suspect SSL/TLS issues,
which at least gives me a decided place to start investigating.
Thanks again for the code, it was sanity inducing to say the least. ;)
Phil Mayers wrote:
> Pywinder Singh wrote:
> > Ideally, I'd love to see a snipped which is able to log into an imap
> > server and gets a list of mailboxes. If the example on the site works
> Here you go:
> from twisted.internet import reactor, protocol, defer
> from twisted.mail import imap4
> # change these...
> username = '?'
> password = '?'
> servername = '?'
> def mailboxes(list):
> for flags,sep,mbox in list:
> print mbox
> def loggedin(res, proto):
> d = proto.list('','*')
> return d
> def connected(proto):
> print "connected", proto
> d = proto.login(username, password)
> d.addCallback(loggedin, proto)
> return d
> def failed(f):
> print "failed", f
> return f
> def done(_):
> reactor.callLater(0, reactor.stop)
> def main():
> c = protocol.ClientCreator(reactor, imap4.IMAP4Client)
> d = c.connectTCP(servername, 143)
> d.addCallbacks(connected, failed)
> reactor.callLater(0, main)
> This example makes use of deferred chaining i.e. returning a deferred
> from a callback handler, so you'll want to understand that.
Some of the changes from 0.8:
Eventlet can now run on top of twisted reactor. Twisted-based hub is
enabled automatically if
twisted.internet.reactor is imported. It is also possible to "embed"
eventlet into a twisted
application via eventlet.twistedutil.join_reactor. See the examples
A new package, eventlet.twistedutil, is added that makes integration
of twisted and eventlet
easier. It has block_on function that allows to wait for a Deferred to
fire and it wraps
twisted's Protocol in a synchronous interface. This is similar to and
is inspired by Christopher
Armstrong's corotwine library. Thanks to Dan Pascu for reviewing the package.
Another new package, eventlet.green, was added to provide some of the
that are fixed not to block other greenlets. This is an alternative to
the socket, which is impossible to do if you are running twisted reactor.
The package includes socket, httplib, urllib2.
Much of the core functionality has been refactored and cleaned up,
including the removal
of eventlet.greenlib. This means that it is now possible to use plain
modification in eventlet, and the subclasses of greenlet instead of the old
eventlet.api.get_hub().switch() now checks to
see whether the current greenlet has a "switch_out" method and calls
it if so, providing the
same functionality that the GreenletContext.swap_out used to. The
swap_in behavior can be
duplicated by overriding the switch method, and the finalize
functionality can be duplicated
by having a try: finally: block around the greenlet's main
implementation. The eventlet.backdoor
module has been ported to this new scheme, although it's signature had
to change slightly so
existing code that used the backdoor will have to be modified.
A number of bugs related to improper scheduling of switch calls has been fixed.
The fixed functions and classes include api.trampoline, api.sleep, coros.event,
Many methods of greenio.GreenSocket were fixed to make its behavior
more like that of a regular
socket. Thanks to Marcin Bachry for fixing GreenSocket.dup to preserve
Added proc module which provides an easy way to subscribe to
coroutine's results. This makes
it easy to wait for a single greenlet or for a set of greenlets to complete.
wsgi.py now supports chunked transfer requests (patch by Mike Barton)
The following modules were deprecated or removed because they were broken:
hubs.nginx, hubs.libev, support.pycurls, support.twisteds, cancel
method of coros.event class
The following classes are still present but will be removed in the
- channel.channel (use coros.Channel)
- coros.CoroutinePool (use pool.Pool)
saranwrap.py now correctly closes the child process when the referring
object is deleted,
received some fixes to its detection of child process death, now
correctly deals with the in
keyword, and it is now possible to use coroutines in a non-blocking
fashion in the child process.
Time-based expiry added to db_pool. This adds the ability to expire
connections both by idleness
and also by total time open. There is also a connection timeout option.
A small bug in httpd's error method was fixed.
Python 2.3 is no longer supported.
A number of tests was added along with a script to run all of them for
all the configurations.
The script generates an html page with the results.
Thanks to Brian Brunswick for investigation of popen4 badness (eventlet.process)
Thanks to Marcus Cavanaugh for pointing out some coros.queue(0) bugs.
The twisted integration as well as many other improvements were funded
by AG Projects (http://ag-projects.com), thanks!