I'm trying to catch an SQLError that is raised due to a "Duplicate
Entry" being inserted into a unique field in the db.

I'm getting a "500 Internal error" when what I really want to do is
catch it within the code.

Here's the browser error:
SQLError: (IntegrityError) (1062, "Duplicate entry... blablabla

And here's the code:
try:
                med = model.Media()
                med.media_name=name
                med.media_authorID=authorID
                :
                :
                session = create_session()
                session.save(med)
                session.flush()
except Exception, e:
                session.close()
                return e

Can't seem to figure out what i'm doing wrong.  Any help would be
appreciated...
btw> I'm using TG 1.0b1 and Python 2.4


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to