As the session is handled by TurboGears, I tried the following:
from turbogears.database import session
try:
MyDBLog(
myfield='A too long string '
)
session.commit()
session.begin()
except Exception, e:
log.error(Exception occurred with database logging:
I don't know of a way to do what you're asking. However, you could simply
create your own constructor for MyDBLog which truncates the string if it is too
long.
Barry
- Original Message
From: Eoghan Murray [EMAIL PROTECTED]
To: sqlalchemy sqlalchemy@googlegroups.com
Sent: Thursday,
Depending on how your code is layed out you could wrap your
session.flush() with a try:/catch I do something like this:
session.begin()
try:
...
session.flush()
session.commit()
except:
session.rollback()
Eoghan Murray wrote:
Hi,
I've the following which generates an insert:
I should mention that in my case, my sessions are non-autoflush, and
non-transactional, so I do my begin()/commits() explicitly.
David Gardner wrote:
Depending on how your code is layed out you could wrap your
session.flush() with a try:/catch I do something like this:
session.begin()
try: