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

Chris McDonough chrism@zope.com
Sun, 20 Jul 2003 12:16:13 -0400


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

Modified Files:
	Application.py 
Log Message:
Use dbtab to mount a temporary folder instead of using the TemporaryFolder class
to do so.


=== Zope/lib/python/OFS/Application.py 1.192 => 1.193 ===
--- Zope/lib/python/OFS/Application.py:1.192	Tue Jul  8 13:03:52 2003
+++ Zope/lib/python/OFS/Application.py	Sun Jul 20 12:16:07 2003
@@ -280,17 +280,19 @@
 
     # Ensure that a temp folder exists
     if not hasattr(app, 'temp_folder'):
-        from Products.TemporaryFolder.TemporaryFolder import \
-             MountedTemporaryFolder
-        tf = MountedTemporaryFolder('temp_folder','Temporary Folder')
-        app._setObject('temp_folder', tf)
-        get_transaction().note('Added temp_folder')
-        get_transaction().commit()
-        del tf
+        from Products.ZODBMountPoint.MountedObject import manage_addMounts
+        try:
+            manage_addMounts(app, ('/temp_folder',))
+            get_transaction().note('Added temp_folder')
+            get_transaction().commit()
+        except:
+            LOG('Zope Default Object Creation', ERROR,
+                'Could not add a /temp_folder mount point due to an error.',
+                error=sys.exc_info())
 
     # Ensure that there is a transient container in the temp folder
-    tf = app.temp_folder
-    if not hasattr(aq_base(tf), 'session_data'):
+    tf = getattr(app, 'temp_folder', None)
+    if tf is not None and not hasattr(aq_base(tf), 'session_data'):
         env_has = os.environ.get
         from Products.Transience.Transience import TransientObjectContainer
         addnotify = env_has('ZSESSION_ADD_NOTIFY', None)