Changeset 3645

Show
Ignore:
Timestamp:
05/09/08 20:44:24 (4 months ago)
Author:
retracile
Message:

AdvancedTicketWorkflowPlugin: Add a 'triage' operation to make it easier for those wanting different workflows for different types of tickets. (And similar such configurations.)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • advancedticketworkflowplugin/0.11/advancedworkflow/controller.py

    r3640 r3645  
    299299        except (CalledProcessError, OSError), e: 
    300300            self.env.log.error("External script %r exited: %s." % (script, e)) 
     301 
     302 
     303class TicketWorkflowOpTriage(TicketWorkflowOpBase): 
     304    """Action to split a workflow based on a field 
     305 
     306    <someaction> = somestatus -> * 
     307    <someaction>.operations = triage 
     308    <someaction>.triage_field = type 
     309    <someaction>.traige_split = defect -> new_defect, task -> new_task, enhancement -> new_enhancement 
     310 
     311    Don't forget to add the `TicketWorkflowOpTriage` to the workflow option in 
     312    [ticket]. 
     313    If there is no workflow option, the line will look like this: 
     314 
     315    workflow = ConfigurableTicketWorkflow,TicketWorkflowOpTriage 
     316    """ 
     317 
     318    _op_name = 'triage' 
     319 
     320    # ITicketActionController methods 
     321 
     322    def render_ticket_action_control(self, req, ticket, action): 
     323        """Returns the action control""" 
     324        actions = ConfigurableTicketWorkflow(self.env).actions 
     325        label = actions[action]['name'] 
     326        new_status = self._new_status(ticket, action) 
     327        if new_status != ticket['status']: 
     328            hint = 'The status will change.' 
     329        else: 
     330            hint = '' 
     331        control = tag('') 
     332        return (label, control, hint) 
     333 
     334    def get_ticket_changes(self, req, ticket, action): 
     335        """Returns the change of status.""" 
     336        return {'status': self._new_status(ticket, action)} 
     337 
     338    def _new_status(self, ticket, action): 
     339        """Determines the new status""" 
     340        field = self.config.get('ticket-workflow', 
     341                                action + '.triage_field').strip() 
     342        transitions = self.config.get('ticket-workflow', 
     343                                      action + '.triage_split').strip() 
     344        for transition in [x.strip() for x in transitions.split(',')]: 
     345            value, status = [y.strip() for y in transition.split('->')] 
     346            if value == ticket[field].strip(): 
     347                break 
     348        else: 
     349            self.env.log.error("Bad configuration for 'triage' operation in action '%s'" % action) 
     350            status = 'new' 
     351        return status 
  • advancedticketworkflowplugin/0.11/setup.py

    r3640 r3645  
    55setup(   
    66        name='AdvancedTicketWorkflowPlugin', 
    7         version='0.5', 
     7        version='0.6', 
    88        author = 'Eli Carter', 
    99        author_email = 'elicarter@retracile.net',