Changeset 3694

Show
Ignore:
Timestamp:
05/17/08 21:38:05 (6 months ago)
Author:
retracile
Message:

AdvancedTicketWorkflowPlugin: Implement a crude 'xref' operation. Bump version to 0.7

Files:

Legend:

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

    r3645 r3694  
    350350            status = 'new' 
    351351        return status 
     352 
     353 
     354class TicketWorkflowOpXRef(TicketWorkflowOpBase): 
     355    """Adds a cross reference to another ticket 
     356 
     357    <someaction>.operations = xref 
     358    <someaction>.xref = "Ticket %s is related to this ticket" 
     359 
     360    Don't forget to add the `TicketWorkflowOpXRef` to the workflow 
     361    option in [ticket]. 
     362    If there is no workflow option, the line will look like this: 
     363 
     364    workflow = ConfigurableTicketWorkflow,TicketWorkflowOpXRef 
     365    """ 
     366 
     367    _op_name = 'xref' 
     368 
     369    # ITicketActionController methods 
     370 
     371    def render_ticket_action_control(self, req, ticket, action): 
     372        """Returns the action control""" 
     373        id = 'action_%s_xref' % action 
     374        ticketnum = req.args.get(id, '') 
     375        actions = ConfigurableTicketWorkflow(self.env).actions 
     376        label = actions[action]['name'] 
     377        hint = 'The specified ticket will be cross-referenced with this ticket' 
     378        control = tag.input(type='text', id=id, name=id, value=ticketnum) 
     379        return (label, control, hint) 
     380 
     381    def get_ticket_changes(self, req, ticket, action): 
     382        """Returns no changes.""" 
     383        return {} 
     384 
     385    def apply_action_side_effects(self, req, ticket, action): 
     386        """Add a cross-reference comment to the other ticket""" 
     387        # TODO: This needs a lot more error checking. 
     388        id = 'action_%s_xref' % action 
     389        ticketnum = req.args.get(id).strip('#') 
     390        actions = ConfigurableTicketWorkflow(self.env).actions 
     391        format_string = actions[action].get('xref', 
     392                                        'Ticket %s is related to this ticket') 
     393        author = req.authname 
     394        comment = format_string % ('#%s' % ticket.id) 
     395        xticket = model.Ticket(self.env, ticketnum) 
     396        # We _assume_ we have sufficient permissions to comment on the other 
     397        # ticket. 
     398        xticket.save_changes(author, comment) 
  • advancedticketworkflowplugin/0.11/setup.py

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