*Hi all,
I'm looking for a easy way to avoid such a IntegrityError:
SQLError: ('(IntegrityError) update or delete on "tipo_figura" violates
foreign key constraint "figura_aziendale_cod_tipo_figura_fkey" on
"figura_aziendale"\nDETAIL: Key (codice)=(S) is still referenced from
table "figura_aziendale".\n', <bound method Controller.save of
<sicer.controllers.tabelleCodifica.tipo_figura.Controller instance at
0xb68e438c>>) 'DELETE FROM tipo_figura WHERE tipo_figura.codice =
%(codice)s' {'codice': 'S'}
I tried in such way...but TurboGears does a commit transaction in any way...
**def save(self, **data):
if data.get('delete'):
try:
ss['record'].delete()
** ss['record'].flush()
** flash("record deleted!")
except **IntegrityError:
** ** ss['record'].expunge()
** ** flash("Cannot delete this record!")
** redirect('.')
**I'm using SQLAlchemy, is there a way to get sqlalchemy check for any
reference to this row before trying to remove it?
*
*Thank you,
j
*
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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?hl=en
-~----------~----~----~----~------~----~------~--~---