[ python-Bugs-901198 ] strange behaviour of xmlrpclib.Server proxy

SourceForge.net noreply at sourceforge.net
Thu Nov 11 22:21:07 CET 2004


Bugs item #901198, was opened at 2004-02-20 16:47
Message generated for change (Comment added) made by merl7n
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=901198&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Andreas Eisele (eisele)
Assigned to: Nobody/Anonymous (nobody)
Summary: strange behaviour of xmlrpclib.Server proxy

Initial Comment:
Not quite sure this is a bug, but the problem caused me 
considerable time to track down (Python 2.3.2 on Solaris).

assume proxy is a variable for a server proxy created with
xmlrpclib.Server(), but sometimes it is None (assume a
default argument to a function).

The comparisons

if proxy != None:

or

if proxy:

fail with (to me) rather incomprehensible error messages.

However, the test

if proxy is not None:

does what I expect.

Is this a feature or a bug?


Thanks a lot for looking into it.

Andreas Eisele

----------------------------------------------------------------------

Comment By: Gerhard Reitmayr (merl7n)
Date: 2004-11-11 21:21

Message:
Logged In: YES 
user_id=12764

I also encountered the same bug. It appears that the
ServerProxy class does not implement the necessary operator
methods and therefore the defined __getattr__ method takes
over and gets it wrong. 

Adding the following methods to ServerProxy resolves the issue:

    def __eq__(self, other):
        return self is other
        
    def __ne__(self, other):
        return self is not other
        
    def __nonzero__(self):
        return True

It would be great, if this could be fixed in xmlrpclib.

Thanks,
  Gerhard Reitmayr

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=901198&group_id=5470


More information about the Python-bugs-list mailing list