I think this would be a bug in 0.11.3.  "ticket.insert()" checks for
the "handle_ta" before committing as you'd want (and I'm guessing the
purpose of the "db" kwarg).  However, the change_listeners aren't
provided this kwarg.  Also, the interface doesn't have a "db" option.

I do see that 0.12 has the new "with_transaction".  Not sure, but the
docstring seems to describe your use case.  I.e. your plugin's "import
multiple tickets" method is wrapped in the decorator.  This would
require, I think, that any change listener would also need to use the
decorator rather than explicit calls to "env.get_db_cnx -> modify ->
db.commit".  This would make the commit to occur at the end of your
"import multiple tickets" method, assuming no exceptions occur.

Perhaps someone more knowledgeable than I could confirm the above.

On Jun 16, 11:21 am, Mike <[email protected]> wrote:
> Hi.  I am trying to create a plug-in that imports multiple tickets and
> I want the creation to be Atomic. As such I supplied the insert method
> a database object. (ticket.insert(db=db))  However I have change
> listeners that commit to the database which causes the transactions to
> occur automatically instead of under my explicit control.  Do you have
> any suggestions.  We are using trac 0.11.3.  Python 2.5 and SQLITE 3.
> Thanks

-- 
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