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 Fri, Jun 25, 2010 at 2:19 PM, Mike <[email protected]> wrote: > I think there was an issue with my previous posting so i am going to > try it again. > > 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]<trac-dev%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/trac-dev?hl=en. > > -- 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.
