[Zope-Checkins] CVS: Zope/lib/python/OFS - Application.py:1.166

Amos Latteier amos@zope.com
Mon, 19 Nov 2001 14:43:30 -0500


Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv12660

Modified Files:
	Application.py 
Log Message:
Make sure that we don't add the examples to the app if they've already been added and then deleted.


=== Zope/lib/python/OFS/Application.py 1.165 => 1.166 ===
         get_transaction().commit()
 
-
     # b/c: Ensure that a temp folder exists
     if not hasattr(app, 'temp_folder'):
         from Products.TemporaryFolder.TemporaryFolder import MountedTemporaryFolder
@@ -472,12 +471,16 @@
         get_transaction().commit()
         del sdm
 
-    # b/c: Ensure that there's an Examples folder with examples
-    if not hasattr(app, 'Examples'):
+    # b/c: Ensure that there's an Examples folder with examples.
+    # However, make sure that if the examples have been added already
+    # and then deleted that we don't add them again.
+    if not hasattr(app, 'Examples') and not \
+       hasattr(app, '_Zope25_examples_have_been_added'):
         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)
+            app._Zope25_examples_have_been_added=1
             get_transaction().note('Added Examples folder')
             get_transaction().commit()
             del examples