[Zope-Checkins] CVS: Zope2 - ObjectManager.py:1.121.4.12
Brian Lloyd
brian@digicool.com
Tue, 3 Apr 2001 11:22:58 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/OFS
In directory korak:/home/brian/temp/zope-23-branch/lib/python/OFS
Modified Files:
Tag: zope-2_3-branch
ObjectManager.py
Log Message:
Fixed string exception usagein import/export
--- Updated File ObjectManager.py in package Zope2 --
--- ObjectManager.py 2001/03/29 14:21:35 1.121.4.11
+++ ObjectManager.py 2001/04/03 15:22:55 1.121.4.12
@@ -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