On 24 nov, 15:31, Massimo Di Pierro <[email protected]>
wrote:
> They run in the same transactions by default.
Nop!
Please see the following example
model:
tb_1 = db.define_table('t1',
Field('field1'),
Field('field2', 'integer')
)
tb_2 = db.define_table('t2',
Field('field1'),
Field('field2', 'integer')
)
controller:
def test():
form = SQLFORM(tb_1)
if form.accepts(request.vars, session):
try:
tb_2.insert(field1='test', field2='1dfdfh') #field2 is
integer, must be a mistake
redirect(URL('test'))
except:
redirect(URL('error'))
elif form.errors:
response.flash = 'errors'
return dict(form=form)
def error():
return dict()
despite the error, the record is inserted in tb_1. And I believe so,
because first submit occurs. So I asked how to include submit and
subsequent actions in a tranasaccion.
Jose