Attachment 'xmlrpc.patch'

Download

   1 diff -r f992fed6e94a MoinMoin/xmlrpc/__init__.py
   2 --- a/MoinMoin/xmlrpc/__init__.py	Sun Dec 06 00:29:33 2009 +0100
   3 +++ b/MoinMoin/xmlrpc/__init__.py	Tue Dec 08 09:16:34 2009 +0100
   4 @@ -555,6 +555,25 @@
   5  
   6          return xmlrpclib.Boolean(1)
   7  
   8 +    def xmlrpc_renamePage(self, pagename, newpagename):
   9 +        """Renames a page to newpagename
  10 +
  11 +        @param pagename: the page name (unicode or utf-8)
  12 +        @param newpagename: then new pagename (unicode or utf-8)
  13 +        @rtype bool
  14 +        @return true on success
  15 +        """
  16 +        if not (self.request.user.may.delete(pagename) and self.request.user.may.write(newpagename)):
  17 +            return xmlrpclib.Fault(1, "You are not allowed to rename this page")
  18 +        editor = PageEditor(self.request, pagename)
  19 +
  20 +        try:
  21 +            editor.renamePage(newpagename)
  22 +        except PageEditor.SaveError, error:
  23 +            return xmlrpclib.Fault(1, "Rename failed: %s" % (str(error), ))
  24 +
  25 +        return xmlrpclib.Boolean(1)
  26 +
  27      def xmlrpc_revertPage(self, pagename, revision):
  28          """Revert a page to previous revision
  29  
  30 @@ -981,9 +1000,41 @@
  31          AttachFile._addLogEntry(self.request, 'ATTNEW', pagename, attachname)
  32          return xmlrpclib.Boolean(1)
  33  
  34 +    def xmlrpc_delAttachment(self, pagename, attachname):
  35 +        """ deletes Attachment from pagename
  36 +
  37 +        @param pagename: pagename (utf-8)
  38 +        @param attachname: attachment name (utf-8)
  39 +        @rtype boolean
  40 +        @return True if attachment was delted
  41 +        """
  42 +        pagename = self._instr(pagename)
  43 +
  44 +        if not self.request.user.may.delete(pagename):
  45 +            return xmlrpclib.Fault(1, 'You are not allowed to delete attachments on this page.')
  46 +
  47 +        attachname = wikiutil.taintfilename(attachname)
  48 +        filename = AttachFile.getFilename(self.request, pagename, attachname)
  49 +        AttachFile.remove_attachment(self.request, pagename, attachname)
  50 +        return xmlrpclib.Boolean(1)
  51 +
  52 +    def xmlrpc_unzipAttachment(self, pagename):
  53 +        """ unzips attachname associated with pagename
  54 +
  55 +        @param pagename: pagename (utf-8)
  56 +        @rtype base64
  57 +        @return base64 data
  58 +        """
  59 +        pagename = self._instr(pagename)
  60 +        #
  61 +        if not (self.request.user.may.delete(pagename) and self.request.user.may.read(pagename) and self.request.user.may.write(pagename)):
  62 +            return xmlrpclib.Fault(1, 'You are not allowed to unzip attachments of this page.')
  63 +
  64 +        AttachFile._do_unzip(pagename, self.request, overwrite=False)
  65 +        return xmlrpclib.Boolean(1)
  66 +
  67      # XXX END WARNING XXX
  68  
  69 -
  70      def xmlrpc_getBotTranslations(self):
  71          """ Return translations to be used by notification bot
  72  

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] (2009-12-08 08:16:52, 2.7 KB) [[attachment:xmlrpc.patch]]
  • [get | view] (2009-12-08 08:17:08, 5.7 KB) [[attachment:xmlrpc_collection_scripts.py]]
 All files | Selected Files: delete move to page copy to page

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