The problem is this. Suppose you try do something that the db does not 
allow. For example insert a duplicate record or invalid sql etc. The 
database server will complain and expects you to rollback the transaction. 
If you do not rollback and try any other db operation, it will close the 
connection.

Normally this is handled automatically by web2py but since you are getting 
that error I assume you may be bypassing the mechanism.

A try except would by pass the mechanism because it would prevent web2py 
from detecting and db error and would continue execution.


On Monday, 3 September 2012 09:37:46 UTC-5, lucas wrote:
>
> ok, i have tons of db() accesses throughout a few thousand lines of code. 
>  thinking out loud,   but since it has to do with session and/or logging in 
> and registering, then i can begin with the initial screens wherein the 
> cookies or such may be reset and such.  i have a few ideas of where, and in 
> those areas i will capture exceptions and rollback as suggested.  what 
> exactly is the exception for the db or DAL?  like
>>
>>
> try:
>   some code
> except DBException on e:
>   db.rollback()
>   return 'db exception: %s' % e
>
> just so that i can at least return more tracking information also.  lucas
>

-- 



Reply via email to