Modify

Opened 7 years ago

Closed 6 years ago

#7316 closed defect (fixed)

NameError: global name 'legacy_action' is not defined

Reported by: ak@… Owned by: Malcolm Studd
Priority: normal Component: ExtendedVersionPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Got the error message "NameError: global name 'legacy_action' is not defined" when clicking on a Version and the user does not have all required permissions. See attached file for a simple fix.

Attachments (1)

LegacyActionErrorFix.patch (445 bytes) - added by ak@… 7 years ago.
Bugfix for legacy action error message.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by ak@…

Attachment: LegacyActionErrorFix.patch added

Bugfix for legacy action error message.

comment:1 Changed 6 years ago by Lucas Rangit MAGASWERAN

This patch fixed the issue for me. I would still like to understand from the following traceback what the permission issue was. Any ideas? Do you get the same traceback?

...
...
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.6/dist-packages/ExtendedVersionTracPlugin-0.0-py2.6.egg/extendedversion/version.py", lin
e 138, in process_request
    return self._render_view(req, db, version)
  File "/usr/local/lib/python2.6/dist-packages/ExtendedVersionTracPlugin-0.0-py2.6.egg/extendedversion/version.py", lin
e 316, in _render_view
    'attachments': AttachmentModule(self.env).attachment_data(context),
  File "/usr/lib/python2.6/dist-packages/trac/attachment.py", line 436, in attachment_data
    'can_create': 'ATTACHMENT_CREATE' in context.perm(new_att),
  File "/usr/lib/python2.6/dist-packages/trac/perm.py", line 524, in has_permission
    return self._has_permission(action, resource)
  File "/usr/lib/python2.6/dist-packages/trac/perm.py", line 538, in _has_permission
    check_permission(action, perm.username, resource, perm)
  File "/usr/lib/python2.6/dist-packages/trac/perm.py", line 425, in check_permission
    perm)
  File "/usr/lib/python2.6/dist-packages/trac/attachment.py", line 798, in check_permission
    resource, perm)
  File "/usr/local/lib/python2.6/dist-packages/ExtendedVersionTracPlugin-0.0-py2.6.egg/extendedversion/version.py", line 85, in check_attachment_permission
    (username, resource, legacy_action))
NameError: global name 'legacy_action' is not defined

comment:2 Changed 6 years ago by Malcolm Studd

Resolution: fixed
Status: newclosed

The issue was that the method called the action 'action' but 'legacy_action' when it went to print the log message.

I changed the name in the log statement, so this should be fixed in by r9265.

Modify Ticket

Action
as closed The owner will remain Malcolm Studd.
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.