Problem patching SimpleXMLRPCServer.py

  • Thread starter Thomas G. Apostolou
  • Start date
T

Thomas G. Apostolou

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top