You can specialise error handlers to ignore certain types of errors or
have multiple error_handlers:
psycopg.ProgrammingError
@turbogears.expose()
@turbogears.validate(form=createReviewerForm)
@turbogears.error_handler(add, "not isinstance(tg_errors,
psycopg.ProgrammingError)")
def create(self, **data):
DataController.create(self, **data)
or
@turbogears.expose()
@turbogears.validate(form=createReviewerForm)
@turbogears.error_handler(add)
@turbogears.error_handler(some_db_thingy, "isinstance(tg_errors,
psycopg.ProgrammingError)")
def create(self, **data):
DataController.create(self, **data)
Where some_db_thingy is an error handler.
Simon
Randall wrote:
Is Assocation by any chance a controller method with parameter tg_errors?
Association is an SQLObject subclass. I shouldn't have put up that
first example. It was lame.
@turbogears.expose()
@turbogears.validate(form=createReviewerForm)
@turbogears.error_handler(add)
def create(self, **data):
DataController.create(self, **data)
Association is defined as the DataController sql_class.
I think I figured out what's happening.
My error handler was attempting to redisplay the form. The form
queries the database and the transaction is borked so the select fails.
I'll probably do try-except-rollback to make this work correctly.
Thanks for your help and sorry for the bad example.
Randall