Package web2py :: Package gluon :: Module xmlrpc

[hide private]
[frames] | no frames]

# Source Code for Module web2py.gluon.xmlrpc

     1  #!/usr/bin/env python
     2  # -*- coding: utf-8 -*-
     3
     4  """
     5  This file is part of the web2py Web Framework
     6  Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
     7  License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
     8  """
     9
    10  from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
    11
    12
    13 -def handler(request, response, methods):
    14      response.session_id = None  # no sessions for xmlrpc
    15      dispatcher = SimpleXMLRPCDispatcher(allow_none=True, encoding=None)
    16      for method in methods:
    17          dispatcher.register_function(method)
    18      dispatcher.register_introspection_functions()
    19      response.headers['Content-Type'] = 'text/xml'
    20      dispatch = getattr(dispatcher, '_dispatch', None)
    21      return dispatcher._marshaled_dispatch(request.body.read(), dispatch)
    22