By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,743 Members | 1,122 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,743 IT Pros & Developers. It's quick & easy.

Problem patching SimpleXMLRPCServer.py

P: n/a
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

Dec 6 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.