Edgewall Software
Modify

Opened 23 months ago

Closed 19 months ago

Last modified 19 months ago

#12927 closed defect (fixed)

Restore support for the "Universal Edit Button"

Reported by: Christian Boos Owned by: Christian Boos
Priority: low Milestone: 1.3.3
Component: wiki system Version:
Severity: minor Keywords: ueb patch
Cc: Branch:
Release Notes:

Restored support for the Universal Edit Button.

API Changes:

Description

Well, quite some time ago the browser extensions for the UniversalEditButton stopped working for me, so I forgot about it.

I gave it another try just now, and the extensions are working again for both FF and Chrome (not found any for Opera or Edge). But now it's Trac that has some trouble with the query string used by these extensions:

.../WikiStart?action=edit&version= gives:

Invalid value for request argument version.

Suggested patch:

  • trac/wiki/web_ui.py

    diff --git a/trac/wiki/web_ui.py b/trac/wiki/web_ui.py
    index 7f6d682..3b15966 100644
    a b class WikiModule(Component):  
    107107    def process_request(self, req):
    108108        action = req.args.get('action', 'view')
    109109        pagename = req.args.get('page', 'WikiStart')
    110         version = req.args.getint('version')
     110        version = req.args.as_int('version', None) # for UEB support
    111111        old_version = req.args.getint('old_version')
    112112
    113113        if pagename.startswith('/') or pagename.endswith('/') or \
    class WikiModule(Component):  
    509509                    'WIKI_VIEW' in req.perm(template_page.resource):
    510510                page.text = template_page.text
    511511        elif 'version' in req.args:
    512             version = req.args.getint('version')
    513             old_page = WikiPage(self.env, page.name, version)
    514             req.perm(page.resource).require('WIKI_VIEW')
    515             page.text = old_page.text
    516             comment = _("Reverted to version %(version)s.", version=version)
     512            version = req.args.as_int('version', None) # for UEB
     513            if version is not None:
     514                old_page = WikiPage(self.env, page.name, version)
     515                req.perm(page.resource).require('WIKI_VIEW')
     516                page.text = old_page.text
     517                comment = _("Reverted to version %(version)s.",
     518                            version=version)
    517519        if action in ('preview', 'diff'):
    518520            page.readonly = 'readonly' in req.args
    519521

Attachments (0)

Change History (4)

comment:1 by figaro, 23 months ago

Keywords: patch added

comment:2 by Ryan J Ollos, 22 months ago

Looks good to me. I would just add a simple unit test in WikiModuleTestCase to ensure we don't break this again.

comment:3 by anonymous, 19 months ago

Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

Committed to trunk in r16425.

comment:4 by Ryan J Ollos, 19 months ago

Owner: set to Christian Boos

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.