Edgewall Software

Ticket #4247 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Ticket Model Component sets wrong 'exists' status

Reported by: simon-code@… Owned by: jonas
Priority: normal Milestone: 0.11
Component: ticket system Version: 0.10.2
Severity: minor Keywords:
Cc:

Description

I am trying to remove the default created components from the Ticket system using Ticket Model (through code), but the result is a Traceback: AssertionError: Cannot deleting non-existent component (typo here by the way :-)

Somehow trac.ticket.model.Component sets the wrong exists status - illustration from a new (default) Trac environment (it only seems to affect Component):

>>> from trac.env import Environment
>>> myenv = Environment('/path/to/my/env')
>>> from trac.ticket.model import Priority, Component, Milestone
>>> for milestone in Milestone(myenv).select(myenv):
        print milestone.name, milestone.exists
milestone1 True
milestone2 True
milestone3 True
milestone4 True
>>> for priority in Priority(myenv).select(myenv):
        print priority.name, priority.exists
blocker True
critical True
major True
minor True
trivial True
>>> for component in Component(myenv).select(myenv):
        print component.name, component.exists
component1 False
component2 False

Attachments

t4247.diff Download (2.9 KB) - added by Tim Hatch <trac@…> 3 years ago.
Patch against trunk#4335 including unit test for this issue

Change History

Changed 3 years ago by simon-code@…

Decided to test them all, and it also happens for Version:

>>> from trac.ticket.model import Version
>>> for version in Version(myenv).select(myenv):
        print version.name, version.exists
2.0 False
1.0 False

Other property types tested OK.

Changed 3 years ago by Tim Hatch <trac@…>

Patch against trunk#4335 including unit test for this issue

Changed 3 years ago by Tim Hatch <trac@…>

Confirmed in trunk. Component and Version use custom classes, but most other classes under trac.ticket.model derive from AbstractEnum which was properly setting _old_name in select(). I've attached t4247.diff Download (and the # in the attachment description was supposed to be @)

Changed 3 years ago by simon-code@…

That seems to solve it. Thanks for spotting and preparing a fix!

Changed 3 years ago by cboos

  • status changed from new to closed
  • resolution set to fixed
  • severity changed from normal to minor
  • milestone set to 0.11

Thanks! Patch applied in r4350.

Add/Change #4247 (Ticket Model Component sets wrong 'exists' status)

Author


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


Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from jonas. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.