Use ITicketManipulator to alter the ticket before it is saved.

--Noah

On Thu, 22 May 2008 16:03:22 -0700 (PDT)
Farialima <[EMAIL PROTECTED]> wrote:

> 
> I'd like to create a plugin that resets a custom field of the ticket
> whenever the ticket is closed.
> 
> I'm using the ITicketChangeListener.ticket_changed method like this:
> 
>     def ticket_changed(self, ticket, comment, author, old_values):
>         # This line will also avoid recursion...
>         if ticket['status'] != 'closed' or ticket['effort'] == '0':
>             return
> 
>         ticket['effort'] = '0'
>         ticket.save_changes(author, "reset effort to zero when
> closing")
> 
> 
> but when I call save_changes, I get:
> 
>   Trac detected an internal error:
>   IntegrityError: columns ticket, time, field are not unique
> 
> This is because the change time of my change, is the same as the
> change of the ticket that just happened - so the insert in the
> 'ticket_change' table for the comment happens at the same time as the
> first change - and SQLlite barfs.
> 
> The workaround is to wait a little before saving, like this:
>   import time
>   time.sleep(1)
> 
> but it's not very clean....
> 
> Could this be considered as a bug ?
> 
> I'm not the first one reporting this issue, see
> http://groups.google.com/group/trac-users/browse_thread/thread/35cf90c46fc8058a
> 
> François
> > 
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to