Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#11511 closed defect (fixed)

Strange message for intertrac without link

Reported by: Jun Omae Owned by: Jun Omae
Priority: low Milestone: 0.12.6
Component: wiki system Version:
Severity: normal Keywords: intertrac
Cc:
Release Notes:

Backported [12048] for #11283: Improved error message for an intertrac link to a non-existent or forbidden changeset.

API Changes:

Description

http://trac.edgewall.org/demo-0.12/intertrac/r0 says the following.

Can't view r0: privileges are required to perform this operation

In this site, trac:r0 says…

Can't view r0: privileges are required to perform this operation. You don't have the required permissions.

That is wrong use of PermissionError at tags/trac-0.12.5/trac/wiki/intertrac.py@:56#L45. The message should be specified with msg keyword argument.

  • trac/wiki/intertrac.py

    diff --git a/trac/wiki/intertrac.py b/trac/wiki/intertrac.py
    index fab670c..6cd5c64 100644
    a b class InterTracDispatcher(Component):  
    5353        if isinstance(link_frag, (Element, Fragment)):
    5454            elt = find_element(link_frag, 'href')
    5555            if elt is None: # most probably no permissions to view
    56                 raise PermissionError(_("Can't view %(link)s:", link=link))
     56                raise PermissionError(msg=_("Can't view %(link)s:", link=link))
    5757            href = elt.attrib.get('href')
    5858        else:
    5959            href = req.href(link.rstrip(':'))

Attachments (0)

Change History (7)

comment:1 Changed 5 years ago by Ryan J Ollos

Changes were recently made on 1.0-stable to address this. See #11283. I guess I should have backported the changes to 0.12-stable.

comment:2 Changed 5 years ago by Jun Omae

Thanks for pointer and suggestion. The issue doesn't exist on 1.0-stable.

But I don't want a new translation message by backport of the changes on 0.12-stable.

comment:3 Changed 5 years ago by Jun Omae

Owner: set to Jun Omae
Status: newassigned

I reconsider it. I think we should backport [12048] for #11283 to 0.12-stable. Also, the use of PermissionError in intertrac.py leads glitch of th:PermRedirectPlugin.

comment:4 Changed 5 years ago by Jun Omae

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

Backported in [12680]

comment:5 in reply to:  3 ; Changed 5 years ago by Ryan J Ollos

Replying to jomae:

Also, the use of PermissionError in intertrac.py leads glitch of th:PermRedirectPlugin.

th:PermRedirectPlugin appear to redirect on PermissionError (th:browser:permredirectplugin/trunk/permredirect/filter.py@12446:66#L64), but that seems expected. What issue were you seeing?

edit: Looking at this more closely now, maybe we don't want it to redirect since it may be a case of the resource not being found.

Last edited 5 years ago by Ryan J Ollos (previous) (diff)

comment:6 in reply to:  5 Changed 5 years ago by Jun Omae

Replying to rjollos:

edit: Looking at this more closely now, maybe we don't want it to redirect since it may be a case of the resource not being found.

Yes, you're right.

Before [12680] and [12048], Trac raises a PermissionError for non-existent resource in intertrac and the plugin redirect to login page. But Trac raises NotFound for the non-existent resource after logged in.

I think the behavior confuses the users.

comment:7 Changed 4 years ago by Ryan J Ollos

Release Notes: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


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