Re: Pyramid transactions and other request lifecycle events

2011-08-04 Thread Chris McDonough
On Wed, 2011-08-03 at 22:44 -0700, Mike Orr wrote: On Wed, Aug 3, 2011 at 12:34 PM, Matt Feifarek matt.feifa...@gmail.com wrote: On Wed, Aug 3, 2011 at 1:12 PM, Chris McDonough chr...@plope.com wrote: In fact, an argument could be made that if a transaction fails, the entire contents

Re: Pyramid transactions and other request lifecycle events

2011-08-04 Thread Mike Orr
On Wed, Aug 3, 2011 at 11:06 PM, Chris McDonough chr...@plope.com wrote: On Wed, 2011-08-03 at 22:44 -0700, Mike Orr wrote: On Wed, Aug 3, 2011 at 12:34 PM, Matt Feifarek matt.feifa...@gmail.com wrote: On Wed, Aug 3, 2011 at 1:12 PM, Chris McDonough chr...@plope.com wrote: In fact, an

Re: Pyramid transactions and other request lifecycle events

2011-08-04 Thread Matt Feifarek
On Thu, Aug 4, 2011 at 12:44 AM, Mike Orr sluggos...@gmail.com wrote: The transaction should fail when the update query is run, not when it commits. So you shouldn't set the 'authenticated' flag until the query finishes without error. Good advice, but not possible in this case; I'm using

Re: Pyramid transactions and other request lifecycle events

2011-08-04 Thread Chris McDonough
On Thu, 2011-08-04 at 11:15 -0500, Matt Feifarek wrote: On Thu, Aug 4, 2011 at 12:44 AM, Mike Orr sluggos...@gmail.com wrote: The transaction should fail when the update query is run, not when it commits. So you shouldn't set the 'authenticated' flag until the

Re: Pyramid transactions and other request lifecycle events

2011-08-04 Thread Mike Orr
On Thu, Aug 4, 2011 at 9:15 AM, Matt Feifarek matt.feifa...@gmail.com wrote: On Thu, Aug 4, 2011 at 12:44 AM, Mike Orr sluggos...@gmail.com wrote: The transaction should fail when the update query is run, not when it commits. So you shouldn't set the 'authenticated' flag until the query

Re: Pyramid transactions and other request lifecycle events

2011-08-04 Thread Matt Feifarek
On Thu, Aug 4, 2011 at 12:06 PM, Chris McDonough chr...@plope.com wrote: I kinda feel like there is still a larger question here, though... using transaction manager, code that is executed in a view callable doesn't *really* finish till after the users' function is over... so there's no

Re: Pyramid transactions and other request lifecycle events

2011-08-04 Thread Matt Feifarek
On Thu, Aug 4, 2011 at 1:37 PM, Chris McDonough chr...@plope.com wrote: when using transactions, how all-in does one have to go? I guess in a sense the answer is none and a lot at the same time. The transaction machinery provides a hook to do something based on the commit status. If the

Re: Pyramid transactions and other request lifecycle events

2011-08-03 Thread Matt Feifarek
On Tue, Aug 2, 2011 at 11:48 PM, Michael Merickel mmeri...@gmail.comwrote: Ben was investigating the idea of tying pyramid_beaker to a transaction, but I'm not sure if anything ever came of it. Maybe we should resurrect the idea. It seems to make sense. In fact, an argument could be made

Re: Pyramid transactions and other request lifecycle events

2011-08-03 Thread Chris McDonough
On Wed, 2011-08-03 at 11:04 -0500, Matt Feifarek wrote: On Tue, Aug 2, 2011 at 11:48 PM, Michael Merickel mmeri...@gmail.com wrote: Ben was investigating the idea of tying pyramid_beaker to a transaction, but I'm not sure if anything ever came of it. Maybe we should

Re: Pyramid transactions and other request lifecycle events

2011-08-03 Thread Matt Feifarek
On Wed, Aug 3, 2011 at 1:12 PM, Chris McDonough chr...@plope.com wrote: In fact, an argument could be made that if a transaction fails, the entire contents of the view callable should not execute... We don't know whether the transaction failed until the view callable is called. The

Re: Pyramid transactions and other request lifecycle events

2011-08-03 Thread Chris McDonough
On Wed, 2011-08-03 at 14:34 -0500, Matt Feifarek wrote: On Wed, Aug 3, 2011 at 1:12 PM, Chris McDonough chr...@plope.com wrote: In fact, an argument could be made that if a transaction fails, the entire contents of the view callable should not execute...

Re: Pyramid transactions and other request lifecycle events

2011-08-03 Thread Mike Orr
On Wed, Aug 3, 2011 at 12:34 PM, Matt Feifarek matt.feifa...@gmail.com wrote: On Wed, Aug 3, 2011 at 1:12 PM, Chris McDonough chr...@plope.com wrote: In fact, an argument could be made that if a transaction fails, the entire contents of the view callable should not execute... We don't know

Re: Pyramid transactions and other request lifecycle events

2011-08-02 Thread Michael Merickel
Ben was investigating the idea of tying pyramid_beaker to a transaction, but I'm not sure if anything ever came of it. Maybe we should resurrect the idea. -- Michael -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send

Pyramid transactions and other request lifecycle events

2011-08-01 Thread Matt Feifarek
I am using tm2 in my Pyramid application, and both ZODB and pyramid_mailer are hooking into that. However, other events related to the request lifecycle are not aware of transactions and are thusly causing suprising behavior that might be worth discussion. For example, I create a new object from

Re: Pyramid transactions and other request lifecycle events

2011-08-01 Thread Carlos de la Guardia
You can register a callback that is called after the transaction ends, so that the logging can be done there. See this page, near the end of the linked section: http://zodb.readthedocs.org/en/latest/transactions.html#repoze-tm2-transaction-aware-middleware-for-wsgi-applications Carlos de la

Re: Pyramid transactions and other request lifecycle events

2011-08-01 Thread Matt Feifarek
On Mon, Aug 1, 2011 at 11:19 AM, Carlos de la Guardia carlos.delaguar...@gmail.com wrote: You can register a callback that is called after the transaction ends, so that the logging can be done there. See this page, near the end o That's interesting, but kinda defeats the purpose of logging