Problem patching SimpleXMLRPCServer.py

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thomas G. Apostolou

    #1

    Problem patching SimpleXMLRPCServer.py

    Hello all,
    I use Python 2.3.3 and try to patch SimpleXMLRPCSer ver.py with the patch i
    got from Python.org.
    so after changing to the directory where both SimpleXMLRPCSer ver.py and
    SimpleXMLRPCSer ver.patch reside i run :
    patch -i SimpleXMLRPCSer ver.patch -b --verbose --dry-run
    SimpleXMLRPCSer ver.py
    and i get :
    Hmm...patch: **** unexpected end of hunk at line 47

    The SimpleXMLRPCSer ver.patch file at lines 24-48 reads like :
    --- 107,128 ----
    import types
    import os

    ! def resolve_dotted_ attribute(obj, attr, allow_dotted_na mes=True):
    """resolve_dott ed_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_na mes argument is false, dots are not
    + supported and this function operates similar to getattr(obj, attr).
    """

    ! if allow_dotted_na mes:
    ! 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 SimpleXMLRPCSer ver.py at lines 107-128 reads like :
    import types
    import os

    def resolve_dotted_ attribute(obj, attr):
    """resolve_dott ed_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_met hods(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



Working...