Problem patching SimpleXMLRPCServer.py
Thomas G. Apostolou
thomas.info at hol.gr
Tue Dec 6 06:17:37 EST 2005
Hello all,
I use Python 2.3.3 and try to patch SimpleXMLRPCServer.py with the patch i
got from Python.org.
so after changing to the directory where both SimpleXMLRPCServer.py and
SimpleXMLRPCServer.patch reside i run :
patch -i SimpleXMLRPCServer.patch -b --verbose --dry-run
SimpleXMLRPCServer.py
and i get :
Hmm...patch: **** unexpected end of hunk at line 47
The SimpleXMLRPCServer.patch file at lines 24-48 reads like :
--- 107,128 ----
import types
import os
! def resolve_dotted_attribute(obj, attr, allow_dotted_names=True):
"""resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d
Resolves a dotted attribute name to an object. Raises
an AttributeError if any attribute in the chain starts with a '_'.
+
+ If the optional allow_dotted_names argument is false, dots are not
+ supported and this function operates similar to getattr(obj, attr).
"""
! if allow_dotted_names:
! attrs = attr.split('.')
! else:
! attrs = [attr]
!
! for i in attrs:
if i.startswith('_'):
raise AttributeError(
'attempt to access private attribute "%s"' % i
***************
*** 156,162 ****
The SimpleXMLRPCServer.py at lines 107-128 reads like :
import types
import os
def resolve_dotted_attribute(obj, attr):
"""resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d
Resolves a dotted attribute name to an object. Raises
an AttributeError if any attribute in the chain starts with a '_'.
"""
for i in attr.split('.'):
if i.startswith('_'):
raise AttributeError(
'attempt to access private attribute "%s"' % i
)
else:
obj = getattr(obj,i)
return obj
def list_public_methods(obj):
"""Returns a list of attribute strings, found in the specified
object, which represent callable attributes"""
i am trying to understand what is wrong, trying to change 107-128 to 107-125
but it doesn't seem to work...
any solution or explanation would be helpfull
Thomas G. Apostolou
More information about the Python-list
mailing list