| 27 | 28 | yield ('TICKET_VIEW', ((list,), (list, str)), self.query) |
| 28 | 29 | yield ('TICKET_VIEW', ((list, xmlrpclib.DateTime),), self.getRecentChanges) |
| 29 | 30 | yield ('TICKET_VIEW', ((list, int),), self.getAvailableActions) |
| 30 | 32 | yield ('TICKET_VIEW', ((list, int),), self.get) |
| 31 | 33 | yield ('TICKET_CREATE', ((int, str, str), (int, str, str, dict), (int, str, str, dict, bool)), self.create) |
| 32 | 34 | yield ('TICKET_ADMIN', ((list, int, str), (list, int, str, dict), (list, int, str, dict, bool)), self.update) |
| | 72 | |
| | 73 | def executeAction(self, req, id, action, comment): |
| | 74 | """Executes the given action on the ticket.""" |
| | 75 | ticket = model.Ticket(self.env, id) |
| | 76 | TicketModule(self.env)._populate(req, ticket) |
| | 77 | valid = TicketModule(self.env)._validate_ticket(req, ticket) |
| | 78 | actions = TicketSystem(self.env).get_available_actions( |
| | 79 | req, ticket) |
| | 80 | if action not in actions: |
| | 81 | raise TracError(_('Invalid action "%(name)s"', name=action)) |
| | 82 | field_changes, problems = TicketModule(self.env).get_ticket_changes(req, ticket, |
| | 83 | action) |
| | 84 | if problems: |
| | 85 | valid = False |
| | 86 | for problem in problems: |
| | 87 | add_warning(req, problem) |
| | 88 | add_warning(req, |
| | 89 | tag(tag.p('Please review your configuration, ' |
| | 90 | 'probably starting with'), |
| | 91 | tag.pre('[trac]\nworkflow = ...\n'), |
| | 92 | tag.p('in your ', tag.tt('trac.ini'), '.')) |
| | 93 | ) |
| | 94 | if valid: |
| | 95 | TicketModule(self.env)._apply_ticket_changes(ticket, field_changes) |
| | 96 | ticket.save_changes(req.authname or 'anonymous', comment) |