Sha256: 79454906d5fde64c4794df71fc950612979bc5b69f9092630a0dccebdac09d19

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

from trac.ticket import ITicketChangeListener, Ticket
from trac.core import *
from manager import WorkLogManager

class WorkLogTicketObserver(Component):
    implements(ITicketChangeListener)
    def __init__(self):
        pass

    def ticket_created(self, ticket):
        """Called when a ticket is created."""
        pass
    
    def ticket_changed(self, ticket, comment, author, old_values):
        """Called when a ticket is modified.
        
        `old_values` is a dictionary containing the previous values of the
        fields that have changed.
        """
        if self.config.getbool('worklog', 'autostop') \
               and 'closed' == ticket['status'] \
               and old_values.has_key('status') \
               and 'closed' != old_values['status']:
            mgr = WorkLogManager(self.env, self.config)
            who,since = mgr.who_is_working_on(ticket.id)
            if who:
                mgr = WorkLogManager(self.env, self.config, who)
                mgr.stop_work()

    def ticket_deleted(self, ticket):
        """Called when a ticket is deleted."""
        pass

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
keithsalisbury-subtrac-0.1.1 lib/subtrac/trac-plugins/worklogplugin/worklog/ticket_daemon.py
keithsalisbury-subtrac-0.1.2 lib/subtrac/trac-plugins/worklogplugin/worklog/ticket_daemon.py
keithsalisbury-subtrac-0.1.3 lib/subtrac/trac-plugins/worklogplugin/worklog/ticket_daemon.py
keithsalisbury-subtrac-0.1.4 lib/subtrac/trac-plugins/worklogplugin/worklog/ticket_daemon.py