Modify

Opened 7 years ago

Closed 7 years ago

#1592 closed enhancement (fixed)

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

Reported by: osimons Owned by: athomas
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 7 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 7 years ago by athomas

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from athomas. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.