Web2py supports multiple database connections since Fall 2007.
It also supports distributed transactions (for postgresql, mysql and firebird)
Assuming you have two (or more) connections let's say:
db1=DAL('postgres://...')
db2=DAL('firebird://...')
in your models or controllers, you can commit them both explicitly with
from gluon.sql import SQLDB
... do your stuff ...
SQLDB.distributed_transaction_commit(db1,db2)
It will rollback and raise Exception on failure.