Commit 96255b20 authored by Chris McDonough's avatar Chris McDonough

Made examples import work with INSTANCE_HOME setups that might not have an Examples.zexp

parent d4c75698
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
############################################################################## ##############################################################################
__doc__='''Application support __doc__='''Application support
$Id: Application.py,v 1.164 2001/11/17 15:56:01 chrism Exp $''' $Id: Application.py,v 1.165 2001/11/17 17:51:54 chrism Exp $'''
__version__='$Revision: 1.164 $'[11:-2] __version__='$Revision: 1.165 $'[11:-2]
import Globals,Folder,os,sys,App.Product, App.ProductRegistry, misc_ import Globals,Folder,os,sys,App.Product, App.ProductRegistry, misc_
import time, traceback, os, string, Products import time, traceback, os, string, Products
...@@ -474,12 +474,16 @@ def initialize(app): ...@@ -474,12 +474,16 @@ def initialize(app):
# b/c: Ensure that there's an Examples folder with examples # b/c: Ensure that there's an Examples folder with examples
if not hasattr(app, 'Examples'): if not hasattr(app, 'Examples'):
examples=app._p_jar.importFile( examples_path = os.path.join(Globals.data_dir, 'Examples.zexp')
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) app._setObject('Examples', examples)
get_transaction().note('Added Examples folder') get_transaction().note('Added Examples folder')
get_transaction().commit() get_transaction().commit()
del examples 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. # b/c: Ensure that Owner role exists.
if hasattr(app, '__ac_roles__') and not ('Owner' in app.__ac_roles__): if hasattr(app, '__ac_roles__') and not ('Owner' in app.__ac_roles__):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment