Ticket #4247 (closed defect: fixed)
Opened 5 years ago
Last modified 5 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: | |||
| Release Notes: | |||
| API Changes: | |||
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
Change History
comment:1 Changed 5 years ago by simon-code@…
Changed 5 years ago by Tim Hatch <trac@…>
- Attachment t4247.diff added
Patch against trunk#4335 including unit test for this issue
comment:2 Changed 5 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 (and the # in the attachment description was supposed to be @)
comment:3 Changed 5 years ago by simon-code@…
That seems to solve it. Thanks for spotting and preparing a fix!
comment:4 Changed 5 years ago by cboos
- Milestone set to 0.11
- Resolution set to fixed
- Severity changed from normal to minor
- Status changed from new to closed
Thanks! Patch applied in r4350.



Decided to test them all, and it also happens for Version:
Other property types tested OK.