Is there active work on the xmlrpclib module these days? The HTTPTransport patch/addition should likely go out with 2.3 as it adds easy authentication and proxy support to xmlrpclib. Also, the unicode support in xmlrpclib is broken in that it can't handle subclasses of <type 'unicode'>. b.bum
Bill> Is there active work on the xmlrpclib module these days? The Bill> HTTPTransport patch/addition should likely go out with 2.3 as it Bill> adds easy authentication and proxy support to xmlrpclib. Can you provide a SF id? I can't seem to find it. Bill> Also, the unicode support in xmlrpclib is broken in that it can't Bill> handle subclasses of <type 'unicode'>. Does it handle subclasses of str? Skip
On Thursday, Mar 6, 2003, at 11:50 US/Eastern, Skip Montanaro wrote:
Bill> Is there active work on the xmlrpclib module these days? The Bill> HTTPTransport patch/addition should likely go out with 2.3 as it Bill> adds easy authentication and proxy support to xmlrpclib.
Can you provide a SF id? I can't seem to find it.
It had been closed or moved out of the SF bug queue by Fred about the same time he left python-dev, I believe. I had sent the HTTPTransport source to Fred, but that sounds like a dead end these days. Found it: 648658
Bill> Also, the unicode support in xmlrpclib is broken in that it can't Bill> handle subclasses of <type 'unicode'>.
Does it handle subclasses of str?
I haven't tested, but looking at the implementation, I don't think it will. In my case, I'm using xmlrpclib in the context of a Cocoa/Python based application that frequently uses Objective-C sourced strings as a part of the RPC request. The PyObjC bridge now bridges NSStrings as a subclass of unicode. Currently, the Marshaller class in xmlrpclib builds a simple dictionary of types used to encode raw objects to XML. class Marshaller: ... dispatch = {} ... def dump_string(self, value, escape=escape): self.write("<value><string>%s</string></value>\n" % escape(value)) dispatch[StringType] = dump_string if unicode: def dump_unicode(self, value, escape=escape): value = value.encode(self.encoding) self.write("<value><string>%s</string></value>\n" % escape(value)) dispatch[UnicodeType] = dump_unicode ... Where the dump method is: def __dump(self, value): try: f = self.dispatch[type(value)] except KeyError: raise TypeError, "cannot marshal %s objects" % type(value) else: f(self, value) So, no, it doesn't do subclasses properly. The workaround [for me] was easy... and bogus: import xmlrpclib Marshaller.dispatch[type(NSString.stringWithString_(''))] = Marshaller.dispatch[type(u'')] b.bum
Bill Bumgarner writes:
It had been closed or moved out of the SF bug queue by Fred about the same time he left python-dev, I believe. I had sent the HTTPTransport source to Fred, but that sounds like a dead end these days.
Sorry; I've just been really busy on other things. I'm on python-dev these days, though I skim the messages very quickly.
Found it: 648658 ... I haven't tested, but looking at the implementation, I don't think it will.
I wish you were wrong on this, but I don't think you are. ;-(
In my case, I'm using xmlrpclib in the context of a Cocoa/Python based application that frequently uses Objective-C sourced strings as a part of the RPC request. The PyObjC bridge now bridges NSStrings as a subclass of unicode. ... So, no, it doesn't do subclasses properly. The workaround [for me] was easy... and bogus:
import xmlrpclib Marshaller.dispatch[type(NSString.stringWithString_(''))] = Marshaller.dispatch[type(u'')]
Yeah, not too pretty. For things like this, where some manner of dispatch is needed based on type, but the type itself doesn't provide some appropriate method, there's a real problem associating the right bit of code, and I'm quite torn as to the right approach to take. ;-( -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation
Fred> For things like this, where some manner of dispatch is needed Fred> based on type, but the type itself doesn't provide some Fred> appropriate method, there's a real problem associating the right Fred> bit of code, and I'm quite torn as to the right approach to take. Slower in some cases, but couldn't you walk up the __bases__ chain until you pop off the top or hit a match in the dispatch dict? For stuff like the NSString stuff, perhaps adding a registration function to the marshaller would be appropriate. Of course, there's the problem coming out the other side. Does it matter if you put in a subclass of str and get out a plain old str? Also, xmlrpclib is built to take advantage of a number of speedup helper modules. In production usage I've found it unbearably slow if used without sgmlop, for example. I'd hate to have the default situation work and have it fail if a speedup module was added to the system. Skip
On Thursday, Mar 6, 2003, at 12:19 US/Eastern, Fred L. Drake, Jr. wrote:
I wish you were wrong on this, but I don't think you are. ;-(
Fred: I apologize [publically]..... my bad. I was mistaking you for the other Fred. In any case, let me know what I can do to contribute to the effort. b.bum
Bill Bumgarner writes:
On Thursday, Mar 6, 2003, at 12:19 US/Eastern, Fred L. Drake, Jr. wrote:
I wish you were wrong on this, but I don't think you are. ;-(
Fred: I apologize [publically]..... my bad. I was mistaking you for the other Fred.
Aha! Yeah, I think both Fredrik and myself have been transmogrified into black holes, even though you meant Fredrik.
In any case, let me know what I can do to contribute to the effort.
We'll, patches are cool. ;-) I have a number of other things that need to be dealt with in other projects still, though I'm glad to help out with xmlrpclib. (There are definately some Expat matters to deal with.) -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation
Bill Bumgarner wrote:
Fred: I apologize [publically]..... my bad. I was mistaking you for the other Fred.
In Sweden, Fred is not a very common nickname for Fredrik. In fact I don't know if I ever heard of a Fred-Fredrik. This includes the bot himself, who just smiles when someone calls him Fred (or Frederick or something). :-) Erik
On Thursday, Mar 6, 2003, at 13:59 US/Eastern, erik heneryd wrote:
In Sweden, Fred is not a very common nickname for Fredrik. In fact I don't know if I ever heard of a Fred-Fredrik. This includes the bot himself, who just smiles when someone calls him Fred (or Frederick or something). :-)
I'm just a hillbilly from the midwest of the US... I wouldn't know. ;-)
participants (4)
-
Bill Bumgarner
-
erik heneryd
-
Fred L. Drake, Jr.
-
Skip Montanaro