[Python-Dev] PEP 343 rewrite complete
Arnold deVos
adv at langdale.com.au
Thu Jun 2 15:47:57 CEST 2005
Guido van Rossum wrote:
> [Phillip J. Eby]
>>* The transaction handler could also be written as:
>>
>> @with_template
>> def transactional(db):
>> db.begin()
>> try:
>> yield db
>> except:
>> db.rollback()
>> else:
>> db.commit()
>>
>>at least, if I understand it correctly.
>
>
> Ah, of course. I've updated the PEP.
>
This template eats eats the exception, which will cause a RuntimeError
in the proposed Wrapper, I think. A raise after rollback is needed.
- Arnold
More information about the Python-Dev
mailing list