On 14.09.2012 15:19, Christopher Nelson wrote:
Is there
some tutorial or other documentation that will tell me how listeners
interact with the system and with each other?
One place where I've been trying to document such things is in [1].
Unfortunately the ITicketChangeListener page is not up yet.
I'm not aware of any other such resource. Unless the Trac source code
counts. :)
For example, if my
listener saves a ticket, does it get called again recursively so I
have to be reentrant? Does another call get deferred until this call
ends? When do other listeners get called for the change my listener
saves?
>
> Here's what I'm trying to do: when a field related to scheduling
> tickets changes, do a minimal schedule recalculation. So, if the
> estimate for a ticket change from 8 hours to 16, any following work
> will start a day later or this task will start a day earlier. In the
> latter case, I'll do all my calculations then have a new start date
> for the ticket that the listener got invoked for. When I save that
> change -- inside the listener -- what happens?
All ITicketChangeListener.ticket_changed() implementations get called in
a loop at the end of Ticket.save_changes() [2].
There is no special mechanism to handle reentrancy.
ITicketChangeListener is not meant to be used in situations where the
ticket gets "manipulated" (="changed before saving"). Instead you should
use ITicketManipulator.validate_ticket().
The ITicketManipulator documentation page [3] already exists.
Improvements are of course appreciated.
[1] http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints
[2]
http://trac.edgewall.org/browser/tags/trac-1.0/trac/ticket/model.py?marks=362-363#L361
[3]
http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.ticket.api.ITicketManipulator
--
Peter
--
You received this message because you are subscribed to the Google Groups "Trac
Development" group.
To post to this group, send email to trac-dev@googlegroups.com.
To unsubscribe from this group, send email to
trac-dev+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/trac-dev?hl=en.