On Nov 10, 1:49 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> On Monday 10 November 2008 12:00:29 Ján ONDREJ (SAL) wrote:
> > Can somebody give me an example, how to handle database errors (like
> > unique key exceptions or foreign key problems) in current TG2? I have
> > one project in TG1, which has been updated to run under TG2. I like
> > news in TG2, but I really need to handle SQL problems some nice way
> > and don't raise standard error without any description, which is
> > default in TG.
>
> I didn't read that out of your last email, but re-reading them now makes
> things clearer for me.
>
> I've hit by that myself - unfortunately, this is actually a limitation of
> SQLAlchemy.

I don't agree. It is not a problem of SQLAlchemy, but it's a problem
of current version of TurboGears.
My application is working well on TurboGears 1.0.7 and worked also on
some TurboGears (I think an alfa, but I am not sure which).
Just it's not working with TurboGears2-1.9.7b1, when
ZopeTransactionExtension is ON.

> See this thread I started:
>
> http://www.mail-archive.com/sqlalchemy%40googlegroups.com/msg10918.html
>
> So far, I've not tried the sub-transaction approach, but settled for
> the "check-before-doing-something"-approach. This of course introduces
> potentially race-conditions. We decided so far to live with them.

I think it's not possible. On some databases (for example on myisam
tables in mysql) I can't check existence of unique element in one
small operation. This value can change small time after my test and
then my transaction fails again.

I think, with this code turbogears going to be a non SQL application.

I like turbogears, because TG works well with databases. But this
changed in this version. :-(

May be something like a special class to check exceptions globally in
turbogears may help.
Something like errorhandler or something similar.

                    SAL

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to