Modify

Opened 10 years ago

Closed 10 years ago

#1592 closed enhancement (fixed)

[Patch] Wiki delete page or version XML-RPC method

Reported by: Odd Simon Simonsen Owned by: Alec Thomas
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

Needed this for myself, but really I think it belongs in the base XML-RPC funtionality as it is also directly supported in the Trac wiki model.

Here is the essential extract of the code I am using:

...
class WikiRPC(Component):
...
    def xmlrpc_methods(self):
...
        yield ('WIKI_DELETE', ((bool, str),(bool, str, int)), self.deletePage)
...
    # Internal methods / handlers
...
    def deletePage(self, req, name, version=None):
        """ Delete a Wiki page (all versions) or a specific version by
        including an optional version number. Attachments will also be
        deleted if page no longer exists. Returns True for success. """
        try:
            wp = WikiPage(self.env, name, version)
            wp.delete(version)
            return True
        except:
            return False
...

Attachments (0)

Change History (2)

comment:1 Changed 10 years ago by anonymous

Oh, that would be surely useful. I have already written two scripts that interact with Trac by scraping the HTML pages (one of them is over 300 lines of PHP). I just found out about XmlRpcPlugin.

Anyway, one of those scripts was to delete spam (spambot had added links to every single page on the wiki), and I couldn't have used XmlRpcPlugin anyway, since it lacks "delete version" functionality.

comment:2 Changed 10 years ago by Alec Thomas

Resolution: fixed
Status: newclosed

(In [2611]) Added wiki.deletePage(), thanks to osimons. Closes #1592.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Alec Thomas.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.