simplexmlrpcserver and allow_none

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Laszlo Nagy

    #1

    simplexmlrpcserver and allow_none


    Hello,

    I ran in the same problem again. Many others have the same problem. Just
    Google for this: "SimpleXMLRPCSe rver allow_none site:python.org ".
    Looks like the 'allow_none' patch was commited to trunk on 2005 Dec (
    http://mail.python.org/pipermail/pyt...er/048289.html )

    I just upgraded to Python 2.4.3 (it was released on March 29, 2006) and
    SimpleXMLRPCSer ver.py still has the old code.
    I can work around this by coping the whole file into a new file and
    patch it, but I hate to do that.
    I wonder why it has not been commited to the standard library yet. Does
    anyone know if it will be in the next bugfix release?

    Thanks,

    Laszlo

  • Thomas Bellman

    #2
    Re: simplexmlrpcser ver and allow_none

    Laszlo Nagy <gandalf@design aproduct.biz> wrote:
    [color=blue]
    > I ran in the same problem again. Many others have the same problem. Just
    > Google for this: "SimpleXMLRPCSe rver allow_none site:python.org ".
    > Looks like the 'allow_none' patch was commited to trunk on 2005 Dec (
    > http://mail.python.org/pipermail/pyt...er/048289.html )[/color]
    [color=blue]
    > I just upgraded to Python 2.4.3 (it was released on March 29, 2006) and
    > SimpleXMLRPCSer ver.py still has the old code.
    > I can work around this by coping the whole file into a new file and
    > patch it, but I hate to do that.
    > I wonder why it has not been commited to the standard library yet. Does
    > anyone know if it will be in the next bugfix release?[/color]

    Fredrik has already answered your specific question, but while
    waiting for 2.5, another way to work around it is to do:

    import xmlrpclib
    # WARNING: Dirty hack below.
    # Replace the dumps() function in xmlrpclib with one that by default
    # handles None, so SimpleXMLRPCSer ver can return None.
    class _xmldumps(objec t):
    def __init__(self, dumps):
    self.__dumps = (dumps,)
    def __call__(self, *args, **kwargs):
    kwargs.setdefau lt('allow_none' , 1)
    return self.__dumps[0](*args, **kwargs)
    xmlrpclib.dumps = _xmldumps(xmlrp clib.dumps)

    import SimpleXMLRPCSer ver


    --
    Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
    "This isn't right. This isn't even wrong." ! bellman @ lysator.liu.se
    -- Wolfgang Pauli ! Make Love -- Nicht Wahr!

    Comment

    • Laszlo Nagy

      #3
      Re: simplexmlrpcser ver and allow_none

      Thomas Bellman írta:[color=blue]
      > Laszlo Nagy <gandalf@design aproduct.biz> wrote:
      >
      >[color=green]
      >> I ran in the same problem again. Many others have the same problem. Just
      >> Google for this: "SimpleXMLRPCSe rver allow_none site:python.org ".
      >> Looks like the 'allow_none' patch was commited to trunk on 2005 Dec (
      >> http://mail.python.org/pipermail/pyt...er/048289.html )
      >>[/color]
      >
      >[color=green]
      >> I just upgraded to Python 2.4.3 (it was released on March 29, 2006) and
      >> SimpleXMLRPCSer ver.py still has the old code.
      >> I can work around this by coping the whole file into a new file and
      >> patch it, but I hate to do that.
      >> I wonder why it has not been commited to the standard library yet. Does
      >> anyone know if it will be in the next bugfix release?
      >>[/color]
      >
      > Fredrik has already answered your specific question, but while
      > waiting for 2.5, another way to work around it is to do:
      >
      > import xmlrpclib
      > # WARNING: Dirty hack below.
      > # Replace the dumps() function in xmlrpclib with one that by default
      > # handles None, so SimpleXMLRPCSer ver can return None.
      > class _xmldumps(objec t):
      > def __init__(self, dumps):
      > self.__dumps = (dumps,)
      > def __call__(self, *args, **kwargs):
      > kwargs.setdefau lt('allow_none' , 1)
      > return self.__dumps[0](*args, **kwargs)
      > xmlrpclib.dumps = _xmldumps(xmlrp clib.dumps)
      >
      > import SimpleXMLRPCSer ver
      >[/color]
      Thank you. :-)
      I already copied out SimpleXMLRPCSer ver.py from the 2.5 trunk and it
      seems to be working, but this is much sorter.

      Laszlo

      Comment

      Working...