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 would like to announce txZMQ, ZeroMQ bindings for Twisted. txZMQ is based
on pyzmq and requires recent ØMQ version (>=2.1).
txZMQ uses ØMQ APIs to get file descriptor that is used to signal pending
actions from ØMQ library IO thread running in separate thread. txZMQ should
be usable with any Twisted reactor.
* The socket library that acts as a concurrency framework.
* Carries messages across inproc, IPC, TCP, and multicast.
* Connect N-to-N via fanout, pubsub, pipeline, request-reply.
* Fast enough for clustered products and supercomputing.
* Asynch I/O for scalable multicore message-passing apps.
Bridging ØMQ and Twisted makes a nice match: fast simple messaging between
Twisted instances solving complex problems :)
* PyPi: http://pypi.python.org/pypi/txZMQ/
* Source code: https://github.com/smira/pyzmq
* pyzmq: http://pypi.python.org/pypi/pyzmq
* ØMQ: http://www.zeromq.org/
Qik Web Team Lead
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 almost gave up choosing twisted until I found this explanation
which basically says a remote_method can return a deferred. In this
case, the PB server won't return the result of the Deferred back to
the client until the server-side callback fires. The result of the
remote_method is then returned to the client, which then triggers
client side's deferred callback.
So, I thought one of the following would be helpful:
1) An example showing remote_method returning a deferred
2) A section named "Server side remote_* methods can be async by
returning deferreds" could be added as a 7th item in
I spent some quality 30+ hours carefully reading 90% of the
and I do not remember picking this subtlety up. (Or you can point me
the right place in doc.) (great doc btw.)
Should I submit an improvement ticket for this? I could also make the
server side example using Echoer, remote_echo, and deferToThread just
so that whoever fixes the ticket can just copy and paste.
I'm experiencing a TypeError exception in my code since I updated to
Twisted 11.1. After hunting it it seems to be caused because the
loseConnection function from (_newtls) lacks arguments.
If there is no OpenSSL support present in the system the
loseConnection function will be called in abstract.FileDescriptor
(please, correct me if I'm wrong), and the signature for
loseConnection is the following:
def loseConnection(self, _connDone=failure.Failure(main.CONNECTION_DONE)):
Shouldn't it be the same for _newtls.ConnectionMixin ? Or perhaps it
should accept *args and **kw and pass them on? Or am I wrong here?
Thanks and regards,
http://saghul.net | http://sipdoc.net
I encountered a problem while dealing with file transfers using PB and t.s.u.FilePager.
The sscce illustrates the problem:
--------- server.py --------------------------------------------------
from twisted.spread import pb
from twisted.internet import reactor
ROOT = '/tmp/'
def __init__(self, fd):
self.fd = fd
def remote_gotPage(self, page):
def remote_createImage(self, imageId):
return ImageCollector(open(ROOT + imageId, 'w'))
--------- client.py --------------------------------------------------
from twisted.spread import pb
from twisted.internet import reactor, defer
from twisted.spread import util
FILE = 'myfile.something'
factory = pb.PBClientFactory()
reactor.connectTCP("localhost", 8789, factory)
d = factory.getRootObject()
return controller.callRemote('createImage', 'image-id')
print ctl.callRemote('dummy') ############# LINE 19 #############
d = defer.Deferred()
util.FilePager(ctl, open(FILE), callback=lambda: d.callback(None))
print "Transfer completed"
I'm trying to *upload* a file from the client to the server by calling a method on the
server which returns a collector to be used with a FilePager instance.
When run with the line client.py:19 commented out, the script blocks before sending
out any file chunks, if the line is uncommented (effectively calling the 'dummy' method
remotely), everything works as expected.
Digging around in the sources, I found out that t.p.u.Pager registers itself to the
collector's pb broker as a pageProducer. When resumeProducing is called on the broker,
it asks the FilePager instance for the next page, which leads to the invocation of
the following method on FilePager::
Get the first chunk read and send it to collector.
if not self.chunks:
val = self.chunks.pop(0)
As the t.b.FileSender producer does not yet had a chance to write something to the
FilePager, the method returns straight away without sending anything.
As anything was sent, the Broker.resumeProducing method is never called again, and
thus the FilePager.sendNextPage neither.
The problem is caused by the calling chain of the FilePager constructor:
-> <no data, don't send anything>
-> FileSender().beginFileTransfer(fd, FilePager)
-> <store data, wait for sendNextPage to be called>
Simply inverting these two method calls (Pager.__init__ and FilePager.startProducing)
solves the problem.
The same problem does not appear when calling the 'dummy' method (client.py:19)
because the data for the method call is waiting to be sent out by the reactor and
the transport does not call 'resumeProducing' on the broker until the next iteration.
This allows the call to FilePager.startProducing to complete before sendNextPage is
ever called on it.
Does this sound correct? It seems only strange to me that nobody else had this problem
previously. If no errors on my side are found, I'll submit this as a ticket.
I've been looking into using twisted.python.constants for representing
the status codes of the XMPP Multi-User Chat protocol . I will have
objects representing messages, of which one of the attributes is
'mucStatuses', a set of status codes. This works out great for the
initial set of available status codes. The protocol is parsed, and the
status codes are represented by the ValueConstant instances returned by
However, not all of the possible codes can be known up-front, as the
protocol allows for registering new ones without changing the
specification itself. Eventually, applications will receive status codes
that are not (yet?) part of the set of defined constants in the
implementation, and application developers (that do know about new
codes) will want to handle these.
A possible remedy to would be to register new status codes from the
application itself. My first try of just adding a new attribute to the
class fails because they are not 'realized' as the _enumerants are cached.
I can imagine this also goes for unknown HTTP methods and HTTP status
codes, used as examples in the documentation. Any suggestions on how to
handle such unknown constants?