Modify ↓
Opened 8 years ago
Closed 8 years ago
#13104 closed defect (fixed)
set_owner_to_component_owner should check existence of selected component
Reported by: | Jun Omae | Owned by: | Eli Carter |
---|---|---|---|
Priority: | normal | Component: | AdvancedTicketWorkflowPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.12 |
Description
If set_owner_to_component_owner
operation is used in workflow and component of the ticket is removed, auto-preview wouldn't work by 404 not found.
How to reproduce:
- Use
set_owenr_to_component_owner
operation - Add
blahblah
to component - Create new ticket with
component1
- Visit the ticket
- Remove
blahblah
component - Select
blahblah
component - Auto-preview receives 404 response and doesn't work
2017-03-08 19:25:32,842 Trac[main] WARNING: [192.168.11.21] HTTPNotFound: 404 Trac Error (Component blahblah does not exist.)
-
advancedworkflow/controller.py
diff --git a/advancedworkflow/controller.py b/advancedworkflow/controller.py index d8cac545b..c5fb3c452 100644
a b from trac.ticket.model import Milestone 16 16 from trac.ticket.notification import TicketNotifyEmail 17 17 from trac.resource import ResourceNotFound 18 18 from trac.util.datefmt import utc 19 from trac.util.text import to_unicode 19 20 from trac.web.chrome import add_warning 20 21 21 22 … … class TicketWorkflowOpOwnerComponent(TicketWorkflowOpBase): 126 127 127 128 def _new_owner(self, ticket): 128 129 """Determines the new owner""" 129 component = model.Component(self.env, name=ticket['component']) 130 self.env.log.debug("component %s, owner %s" % (component, component.owner)) 131 return component.owner 130 try: 131 component = model.Component(self.env, name=ticket['component']) 132 return component.owner 133 except ResourceNotFound, e: 134 self.log.warning("In %s, %s", self._op_name, to_unicode(e)) 135 return None 132 136 133 137 134 138 class TicketWorkflowOpOwnerField(TicketWorkflowOpBase):
After the patch: owner of the ticket would be deleted if selected component isn't existent.
2017-03-08 19:38:46,993 Trac[controller] WARNING: In set_owner_to_component_owner, Component blahblah does not exist.
Attachments (0)
Note: See
TracTickets for help on using
tickets.
reset_milestone
operation has the same issue about milestone of the ticket.advancedworkflow/controller.py
Milestone(self.env,ticket['milestone']).is_completed: