[ZPatterns] TransactionAgents question

John Eikenberry jae-zpat@kavi.com
Tue, 11 Dec 2001 17:09:22 -0800


This is primarily addressed to Steve Alexander, but as its related to
zpatterns it seemed appropriate to post it here.

We're in the process of moving from Zope 2.2.5 to 2.4.3, likewize we're
switching from ZPatterns 0.4.3b2 to ZedPatterns 0.4.3p2-0.0.4.

We used sub-commits in a few places to cause the skinscripts to trigger and
write to an external database in order to catch database errors (duplicate
unique keys and the like).

The issue is that using ZedPatterns the above works, but the skinscript
stays in the queue and gets called again on the final commit. This looks to
be the result of TransactionAgent's method runRuleAgents(). Which runs all
the agents in its queue, removing them from the queue after they've run.
But if the agent raises an exception it never gets removed from the queue.

My temporary workaround is to call newAgentQueues() after I've caught the
base database exception, but before raising my custom exception (which we
handle gracefully to show a nice user oriented error). 

So I have 2 questions.

1. Why not pop the agent from the rules agent queue before running it?
2. If #1 doesn't work, how does my workaround sound. 

I've figured out how to get rid of the subcommits, but it requires we redo
our user oriented error handling/presentation. I was hoping to get it
working as-it-is before I started re-working all that. And this smelled
like a problem others might have. If they handle exceptions in the way I
did (which was the recommended way at the time).

Thanks.

-- 

John Eikenberry [jae@kavi.com]
______________________________________________________________
"A society that will trade a little liberty for a little order
 will deserve neither and lose both."
                                          --B. Franklin