Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#4247 closed defect (fixed)

Ticket Model Component sets wrong 'exists' status

Reported by: simon-code@… Owned by: Jonas Borgström
Priority: normal Milestone: 0.11
Component: ticket system Version: 0.10.2
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal 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 (1)

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

Download all attachments as: .zip

Change History (5)

comment:1 by simon-code@…, 17 years ago

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.

by Tim Hatch <trac@…>, 17 years ago

Attachment: t4247.diff added

Patch against trunk#4335 including unit test for this issue

comment:2 by Tim Hatch <trac@…>, 17 years ago

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 by simon-code@…, 17 years ago

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

comment:4 by Christian Boos, 17 years ago

Milestone: 0.11
Resolution: fixed
Severity: normalminor
Status: newclosed

Thanks! Patch applied in r4350.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström 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.