Christopher Arndt schrieb:
> [EMAIL PROTECTED] schrieb:
>> I have an error now after upgrading to the new TG (1.0.3.2)...is this
>> a bug in TG?
>>
>>   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
>> python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg/turbogears/
>> database.py", line 375, in sa_rwt
>>     return retval
>> UnboundLocalError: local variable 'retval' referenced before assignment
> 
>>From looking at the code, it seems that the error is on lines 365-369 in
> that file. If an "InvalidRequestError" is raised, "retval" is not set.

Yes, instead of "pass" it should probably be:

retval = dispatch_exception(e,args,kw)

Also, I think the rollback() call 3 lines later should go into a
try-except block, just like the commit() call.

So the whole except block could be modified like this (untested):

    except Exception, e:
        if isinstance(e, (cherrypy.HTTPRedirect,
                cherrypy.InternalRedirect)):
            try:
                req.sa_transaction.commit()
            except Exception,e:
                pass
            else:
                raise
        elif not isinstance(e, InvalidRequestError):
            try:
                req.sa_transaction.rollback()
            except Exception,e:
                pass
        retval = dispatch_exception(e,args,kw)

-- ChrisZ

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to