Attachment 'moin_rpc_put_page.patch'

Download

   1 diff -r 2dde35b02026 MoinMoin/_tests/test_rpc.py
   2 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   3 +++ b/MoinMoin/_tests/test_rpc.py	Wed Nov 28 22:47:27 2007 +0100
   4 @@ -0,0 +1,36 @@
   5 +# -*- coding: utf-8 -*-
   6 +"""
   7 +    MoinMoin - rpc interface tests
   8 +
   9 +    @copyright: 2007 by MoinMoin:JonasWagner
  10 +    @license: GNU GPL, see COPYING for details.
  11 +"""
  12 +
  13 +
  14 +import time
  15 +import xmlrpclib
  16 +
  17 +import py
  18 +
  19 +from MoinMoin import xmlrpc
  20 +
  21 +
  22 +class TestPutPage(object):
  23 +    """A unittest for the putpage method of the moin rpc interface"""
  24 +
  25 +    def test_put_empty_page_content(self):
  26 +        interface = xmlrpc.XmlRpc2(self.request)
  27 +        assert isinstance(interface.xmlrpc_putPage("Test", ""),
  28 +                xmlrpclib.Fault)
  29 +
  30 +    def test_put_empty_page_name(self):
  31 +        interface = xmlrpc.XmlRpc2(self.request)
  32 +        assert isinstance(interface.xmlrpc_putPage("", "Test"),
  33 +                xmlrpclib.Fault)
  34 +
  35 +    def test_put_page(self):
  36 +        interface = xmlrpc.XmlRpc2(self.request)
  37 +        # time.time is used to make shure the content is changed every time
  38 +        assert not isinstance(interface.xmlrpc_putPage("Test",
  39 +            str(time.time())), xmlrpclib.Fault)
  40 +
  41 diff -r 2dde35b02026 MoinMoin/xmlrpc/__init__.py
  42 --- a/MoinMoin/xmlrpc/__init__.py	Wed Nov 28 10:43:48 2007 +0100
  43 +++ b/MoinMoin/xmlrpc/__init__.py	Wed Nov 28 22:47:27 2007 +0100
  44 @@ -517,6 +517,9 @@ class XmlRpcBase:
  45  
  46          pagename = self._instr(pagename)
  47  
  48 +        if not pagename:
  49 +            return xmlrpclib.Fault("INVALID", "pagename can't be empty")
  50 +
  51          # check ACLs
  52          if not self.request.user.may.write(pagename):
  53              return xmlrpclib.Fault(1, "You are not allowed to edit this page")

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-11-28 22:34:10, 1.7 KB) [[attachment:moin_rpc_put_page.patch]]
  • [get | view] (2007-11-05 07:54:30, 12.5 KB) [[attachment:traceback.html]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.