[ python-Bugs-1690840 ] xmlrpclib methods submit call on __str__, __repr__
SourceForge.net
noreply at sourceforge.net
Wed Apr 4 17:10:25 CEST 2007
Bugs item #1690840, was opened at 2007-03-29 15:14
Message generated for change (Comment added) made by collinwinter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1690840&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Greg Hazel (ghazel)
>Assigned to: Fredrik Lundh (effbot)
Summary: xmlrpclib methods submit call on __str__, __repr__
Initial Comment:
Notice how trying to print a method causes it to submit the call:
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from xmlrpclib import ServerProxy
>>> s = ServerProxy("http://google.com")
>>> print s.somecall
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python25\lib\xmlrpclib.py", line 1147, in __call__
return self.__send(self.__name, args)
File "c:\python25\lib\xmlrpclib.py", line 1437, in __request
verbose=self.__verbose
File "c:\python25\lib\xmlrpclib.py", line 1191, in request
headers
xmlrpclib.ProtocolError: <ProtocolError for google.com/RPC2: 501 Not Implemented
Similarly:
>>> f = s.somecall
>>> locals()
{'f': Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python25\lib\xmlrpclib.py", line 1147, in __call__
return self.__send(self.__name, args)
File "c:\python25\lib\xmlrpclib.py", line 1437, in __request
verbose=self.__verbose
File "c:\python25\lib\xmlrpclib.py", line 1191, in request
headers
xmlrpclib.ProtocolError: <ProtocolError for google.com/RPC2: 501 Not Implemented>
----------------------------------------------------------------------
>Comment By: Collin Winter (collinwinter)
Date: 2007-04-04 11:10
Message:
Logged In: YES
user_id=1344176
Originator: NO
Fredrik, you originally wrote xmlrpclib: any objections to stringifying
_Method objects to something like "<xmlrpclib _Method somecall at
0x4636e346>"?
----------------------------------------------------------------------
Comment By: Greg Hazel (ghazel)
Date: 2007-04-04 02:45
Message:
Logged In: YES
user_id=731668
Originator: YES
This would be reasonable:
>>> from xmlrpclib import ServerProxy
>>> s = ServerProxy("http://google.com")
>>> print s.somecall
<xmlrpclib._Method object at 0x00C08470>
Similarly:
>>> f = s.somecall
>>> locals()
{'f': <xmlrpclib._Method object at 0x00BA8030>, '__builtins__': <module
'__built
in__' (built-in)>, 's': <ServerProxy for google.com/RPC2>, '__name__':
'__main__
', 'ServerProxy': <class xmlrpclib.ServerProxy at 0x00C61AE0>, '__doc__':
None}
Bonus points for:
<xmlrpclib _Method somecall of <ServerProxy for google.com/RPC2>>
----------------------------------------------------------------------
Comment By: Collin Winter (collinwinter)
Date: 2007-03-29 22:59
Message:
Logged In: YES
user_id=1344176
Originator: NO
What would you rather seem them print?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1690840&group_id=5470
More information about the Python-bugs-list
mailing list