[Zope-Checkins] CVS: Zope/lib/python/OFS - Application.py:1.165
Chris McDonough
chrism@zope.com
Sat, 17 Nov 2001 12:51:55 -0500
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv18132
Modified Files:
Application.py
Log Message:
Made examples import work with INSTANCE_HOME setups that might not have an Examples.zexp
=== Zope/lib/python/OFS/Application.py 1.164 => 1.165 ===
# b/c: Ensure that there's an Examples folder with examples
if not hasattr(app, 'Examples'):
- examples=app._p_jar.importFile(
- os.path.join(Globals.data_dir, 'Examples.zexp'))
- app._setObject('Examples', examples)
- get_transaction().note('Added Examples folder')
- get_transaction().commit()
- del examples
+ examples_path = os.path.join(Globals.data_dir, 'Examples.zexp')
+ if os.path.isfile(os.path.join(examples_path)):
+ examples=app._p_jar.importFile(examples_path)
+ app._setObject('Examples', examples)
+ get_transaction().note('Added Examples folder')
+ get_transaction().commit()
+ del examples
+ else:
+ LOG('Zope Default Object Creation', INFO,
+ '%s examples import file could not be found.' % examples_path)
# b/c: Ensure that Owner role exists.
if hasattr(app, '__ac_roles__') and not ('Owner' in app.__ac_roles__):