changeset 4241:c27f6cb0892e

Fixed: XMLRPC calls
author Florian Krupicka <florian.krupicka@googlemail.com>
date Tue, 22 Jul 2008 20:38:33 +0200
parents 5dad898baf1f
children f61dcab20a3e
files MoinMoin/web/contexts.py MoinMoin/xmlrpc/__init__.py
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/web/contexts.py	Tue Jul 22 20:36:42 2008 +0200
+++ b/MoinMoin/web/contexts.py	Tue Jul 22 20:38:33 2008 +0200
@@ -372,7 +372,7 @@
         self.request.stream.writelines(data)
 
 # TODO: extend xmlrpc context
-class XMLRPCContext(HTTPContext):
+class XMLRPCContext(HTTPContext, PageMixin):
     """ Context to act during a XMLRPC request. """
 
 class AllContext(HTTPContext, RenderContext):
--- a/MoinMoin/xmlrpc/__init__.py	Tue Jul 22 20:36:42 2008 +0200
+++ b/MoinMoin/xmlrpc/__init__.py	Tue Jul 22 20:38:33 2008 +0200
@@ -127,12 +127,13 @@
 
     def process(self):
         """ xmlrpc v1 and v2 dispatcher """
+        request = self.request
         try:
             if 'xmlrpc' in self.request.cfg.actions_excluded:
                 # we do not handle xmlrpc v1 and v2 differently
                 response = xmlrpclib.Fault(1, "This moin wiki does not allow xmlrpc method calls.")
             else:
-                data = self.request.read(self.request.content_length)
+                data = request.in_data
 
                 try:
                     params, method = xmlrpclib.loads(data)
@@ -166,9 +167,10 @@
                 # serialize it
                 response = xmlrpclib.dumps(response, methodresponse=1, allow_none=True)
 
-        self.request.content_type = 'text/xml'
-        self.request.content_length = len(response)
-        self.request.write(response)
+        request = request.request
+        request.content_type = 'text/xml'
+        request.data = response
+        return request
 
     def dispatch(self, method, params):
         """ call dispatcher - for method==xxx it either locates a method called
@@ -1061,9 +1063,8 @@
 
 
 def xmlrpc(request):
-    XmlRpc1(request).process()
-
+    return XmlRpc1(request).process()
 
 def xmlrpc2(request):
-    XmlRpc2(request).process()
+    return XmlRpc2(request).process()