[Zope-Checkins] CVS: Zope2 - ObjectManager.py:1.132

Brian Lloyd brian@digicool.com
Tue, 3 Apr 2001 11:25:16 -0400 (EDT)


Update of /cvs-repository/Zope2/lib/python/OFS
In directory korak:/home/brian/temp/mainline_test/lib/python/OFS

Modified Files:
	ObjectManager.py 
Log Message:
fix for uncatchable string exceptions in import/export



--- Updated File ObjectManager.py in package Zope2 --
--- ObjectManager.py	2001/03/29 14:24:20	1.131
+++ ObjectManager.py	2001/04/03 15:25:14	1.132
@@ -514,9 +514,10 @@
             f=StringIO()
             if toxml: XMLExportImport.exportXML(ob._p_jar, ob._p_oid, f)
             else:     ob._p_jar.exportFile(ob._p_oid, f)
-            RESPONSE.setHeader('Content-type','application/data')
-            RESPONSE.setHeader('Content-Disposition',
-                'inline;filename=%s.%s' % (id, suffix))
+            if RESPONSE is not None:
+                RESPONSE.setHeader('Content-type','application/data')
+                RESPONSE.setHeader('Content-Disposition',
+                                   'inline;filename=%s.%s' % (id, suffix))
             return f.getvalue()
 
         f = os.path.join(CLIENT_HOME, '%s.%s' % (id, suffix))
@@ -537,7 +538,7 @@
         """Import an object from a file"""
         dirname, file=os.path.split(file)
         if dirname:
-            raise 'Bad Request', 'Invalid file name %s' % file
+            raise BadRequestException, 'Invalid file name %s' % file
 
         instance_home = INSTANCE_HOME
         software_home = os.path.join(SOFTWARE_HOME, '..%s..' % os.sep)
@@ -549,7 +550,7 @@
             if os.path.exists(filepath):
                 break
         else:
-            raise 'Bad Request', 'File does not exist: %s' % file
+            raise BadRequestException, 'File does not exist: %s' % file
         # locate a valid connection
         connection=self._p_jar
         obj=self