[Python-checkins] CVS: python/dist/src/Lib xmlrpclib.py,1.6,1.7

Fredrik Lundh effbot@users.sourceforge.net
2001年9月10日 14:45:44 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv6600
Modified Files:
	xmlrpclib.py 
Log Message:
more xmlrpclib tweaks: fixed repr(Fault()); enable UTF-8 parsing in
xmllib (on 2.0 and later)
Index: xmlrpclib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xmlrpclib.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** xmlrpclib.py	2001年09月10日 19:45:02	1.6
--- xmlrpclib.py	2001年09月10日 21:45:42	1.7
***************
*** 167,175 ****
 class Error(Exception):
 """Base class for client errors."""
! pass
 
 class ProtocolError(Error):
 """Indicates an HTTP protocol error."""
 def __init__(self, url, errcode, errmsg, headers):
 self.url = url
 self.errcode = errcode
--- 167,177 ----
 class Error(Exception):
 """Base class for client errors."""
! def __str__(self):
! return repr(self)
 
 class ProtocolError(Error):
 """Indicates an HTTP protocol error."""
 def __init__(self, url, errcode, errmsg, headers):
+ Error.__init__(self)
 self.url = url
 self.errcode = errcode
***************
*** 189,192 ****
--- 191,195 ----
 """Indicates an XML-RPC fault package."""
 def __init__(self, faultCode, faultString, **extra):
+ Error.__init__(self)
 self.faultCode = faultCode
 self.faultString = faultString
***************
*** 194,198 ****
 return (
 "<Fault %s: %s>" %
! (repr(self.faultCode), repr(self.faultString))
 )
 
--- 197,201 ----
 return (
 "<Fault %s: %s>" %
! (self.faultCode, repr(self.faultString))
 )
 
***************
*** 400,405 ****
 self.handle_data = target.data
 self.unknown_endtag = target.end
! xmllib.XMLParser.__init__(self)
! 
 
 # --------------------------------------------------------------------
--- 403,410 ----
 self.handle_data = target.data
 self.unknown_endtag = target.end
! try:
! xmllib.XMLParser.__init__(self, accept_utf8=1)
! except TypeError:
! xmllib.XMLParser.__init__(self) # pre-2.0
 
 # --------------------------------------------------------------------
***************
*** 522,530 ****
 class Unmarshaller:
 """Unmarshal an XML-RPC response, based on incoming XML event
! messages (start, data, end). Call close to get the resulting
 data structure.
 
! Note that this reader is fairly tolerant, and gladly accepts
! bogus XML-RPC data without complaining (but not bogus XML).
 """
 
--- 527,535 ----
 class Unmarshaller:
 """Unmarshal an XML-RPC response, based on incoming XML event
! messages (start, data, end). Call close() to get the resulting
 data structure.
 
! Note that this reader is fairly tolerant, and gladly accepts bogus
! XML-RPC data without complaining (but not bogus XML).
 """
 
***************
*** 689,694 ****
 """getparser() -> parser, unmarshaller
 
! Create an instance of the fastest available parser, and attach
! it to an unmarshalling object. Return both objects.
 """
 if FastParser and FastUnmarshaller:
--- 694,699 ----
 """getparser() -> parser, unmarshaller
 
! Create an instance of the fastest available parser, and attach it
! to an unmarshalling object. Return both objects.
 """
 if FastParser and FastUnmarshaller:
***************
*** 713,718 ****
 request (or response, if the methodresponse option is used).
 
! In addition to the data object, the following options can be
! given as keyword arguments:
 
 methodname: the method name for a methodCall packet
--- 718,723 ----
 request (or response, if the methodresponse option is used).
 
! In addition to the data object, the following options can be given
! as keyword arguments:
 
 methodname: the method name for a methodCall packet
***************
*** 726,730 ****
 All 8-bit strings in the data structure are assumed to use the
 packet encoding. Unicode strings are automatically converted,
! as necessary.
 """
 
--- 731,735 ----
 All 8-bit strings in the data structure are assumed to use the
 packet encoding. Unicode strings are automatically converted,
! where necessary.
 """
 

AltStyle によって変換されたページ (->オリジナル) /