Yeah, sorry I forgot to write that you need session.flush() after session.add(). The error is raised on flush.

.oO V Oo.


On 10/27/2011 03:49 PM, Mark Erbaugh wrote:


Vlad,

Thanks for the reply. That's the way I was leaning. I just wondered if there was a better place to catch the exception within the Pyramid framework. Handlingly it locally in the page processing code makes the most sense as that's where the best knowledge of how to handle it exists.

In my code, it seems like the IntegrityError is actually raised by a call to transaction.commit(), not the call to session.add(). Does your code have some sort of automatic commit going on?

Thanks again,
Mark
--
You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en.

--
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.

Reply via email to