Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11997 closed defect (fixed)

Wrong usage of `pkg_resources.parse_version` in ticketlog/web_ui.py

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Component: TracTicketChangelogPlugin
Severity: minor Keywords:
Cc: Trac Release: 0.11

Description

I found wrong usage of pkg_resources.parse_version in tracticketchangelogplugin/0.12/ticketlog/web_ui.py@14178:60#L57.

I consider that self.supports_multirepos is always True with any versions of Trac.

>>> from pkg_resources import parse_version
>>> parse_version('0.11.7')
('00000000', '00000011', '00000007', '*final')
>>> parse_version('0.12.5')
('00000000', '00000012', '00000005', '*final')
>>> parse_version('0.11.7') >= (0, 12)
True
>>> parse_version('0.12.5') >= (0, 12)
True
>>> parse_version('1.0.1') >= (0, 12)
True
>>> parse_version('1.1.1') >= (0, 12)
True

I think that we should use parse_version('0.12') rather than (0, 12).

  • ticketlog/web_ui.py

     
    5757    def __init__(self):
    5858        locale_dir = resource_filename(__name__, 'locale')
    5959        add_domain(self.env.path, locale_dir)
    60         self.supports_multirepos = parse_version(trac.__version__) >= (0, 12)
     60        self.supports_multirepos = parse_version(trac.__version__) >= \
     61                                   parse_version('0.12')
    6162
    6263    # IPermissionRequestor methods
    6364
>>> parse_version('0.11.7') >= parse_version('0.12')
False
>>> parse_version('0.12') >= parse_version('0.12')
True
>>> parse_version('0.12.1') >= parse_version('0.12')
True

Attachments (0)

Change History (4)

comment:1 Changed 10 years ago by Jun Omae

Severity: normalminor
Trac Release: 0.11

comment:2 Changed 10 years ago by Ryan J Ollos

That was my error in [13954]. Please feel free to fix the issue.

comment:3 Changed 10 years ago by Jun Omae

Resolution: fixed
Status: newclosed

In 14190:

0.2dev: fixed wrong usage of pkg_resources.parse_version (closes #11997)

comment:4 Changed 10 years ago by Jun Omae

Owner: changed from Richard Liao to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
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.