Changeset 2611

Show
Ignore:
Timestamp:
09/03/07 04:38:38 (1 year ago)
Author:
athomas
Message:

Added wiki.deletePage(), thanks to osimons. Closes #1592.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • xmlrpcplugin/trunk/tracrpc/wiki.py

    r2609 r2611  
    1717 
    1818class WikiRPC(Component): 
    19     """ Implementation of the [http://www.jspwiki.org/Wiki.jsp?page=WikiRPCInterface2 WikiRPC API]. """ 
     19    """Superset of the 
     20    [http://www.jspwiki.org/Wiki.jsp?page=WikiRPCInterface2 WikiRPC API]. """ 
    2021 
    2122    implements(IXMLRPCHandler) 
     
    4445                               (bool, str, str, str, xmlrpclib.Binary, bool)), 
    4546                               self.putAttachmentEx) 
     47        yield ('WIKI_DELETE', ((bool, str),(bool, str, int)), self.deletePage) 
    4648        yield ('WIKI_DELETE', ((bool, str),), self.deleteAttachment) 
    4749        yield ('WIKI_VIEW', ((list, str),), self.listLinks) 
     
    117119        return True 
    118120 
     121    def deletePage(self, req, name, version=None): 
     122        """Delete a Wiki page (all versions) or a specific version by 
     123        including an optional version number. Attachments will also be 
     124        deleted if page no longer exists. Returns True for success.""" 
     125        try: 
     126            wp = WikiPage(self.env, name, version) 
     127            wp.delete(version) 
     128            return True 
     129        except: 
     130            return False 
     131 
    119132    def listAttachments(self, req, pagename): 
    120133        """ Lists attachments on a given page. """