[Zope-Checkins] SVN: Products.Five/branches/1.5/fiveconfigure.py Do
not commit if package initialization raises and Exception.
Stefan H. Holek
stefan at epy.co.at
Sat Jun 23 04:41:57 EDT 2007
Log message for revision 76967:
Do not commit if package initialization raises and Exception.
Changed:
U Products.Five/branches/1.5/fiveconfigure.py
-=-
Modified: Products.Five/branches/1.5/fiveconfigure.py
===================================================================
--- Products.Five/branches/1.5/fiveconfigure.py 2007-06-23 08:40:48 UTC (rev 76966)
+++ Products.Five/branches/1.5/fiveconfigure.py 2007-06-23 08:41:54 UTC (rev 76967)
@@ -21,6 +21,7 @@
import glob
import warnings
import logging
+import transaction
import App.config
from App.Product import initializeProduct
@@ -224,22 +225,23 @@
if to_initialize is None:
app = Zope2.app()
try:
- product = initializeProduct(module_,
- module_.__name__,
- module_.__path__[0],
- app)
+ try:
+ product = initializeProduct(module_,
+ module_.__name__,
+ module_.__path__[0],
+ app)
- product.package_name = module_.__name__
+ product.package_name = module_.__name__
- if init_func is not None:
- newContext = ProductContext(product, app, module_)
- init_func(newContext)
+ if init_func is not None:
+ newContext = ProductContext(product, app, module_)
+ init_func(newContext)
+ except:
+ raise
+ else:
+ transaction.commit()
finally:
- try:
- import transaction
- transaction.commit()
- finally:
- app._p_jar.close()
+ app._p_jar.close()
else:
to_initialize.append((module_, init_func,))
More information about the Zope-Checkins
mailing list