Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
- from uwsgidecorators import postfork
- from lib import config as configapp
- @postfork
- def init():
- import __builtin__
- __builtin__.ConfigPhotoserver = configapp.ConfigPhotoserver
- #enddef
- import rpcinterface as iface
- import uwsgi
- dispatch = SimpleXMLRPCDispatcher()
- def registerMethods():
- dispatch.register_introspection_functions()
- dispatch.register_function(iface.getGallery)
- #enddef
- registerMethods()
- def application(environ, start_response):
- if environ["REQUEST_METHOD"] != "POST":
- start_response("500 Error", ())
- return ["Only POST allowed"]
- try:
- length = int(environ.get('CONTENT_LENGTH', None))
- except (TypeError, ValueError):
- length = -1
- request_text = environ["wsgi.input"].read(length)
- response = dispatch._marshaled_dispatch(request_text)
- start_response("200 OK", [("Content-Type", "text/xml"), ("Content-Length", str(len(response)))])
- return response
Advertisement
Add Comment
Please, Sign In to add comment