Commit f6605c17 authored by 's avatar

Made fixes to import/export sanity checking

parent e967b505
...@@ -105,9 +105,9 @@ ...@@ -105,9 +105,9 @@
Folders are the basic container objects and are analogous to directories. Folders are the basic container objects and are analogous to directories.
$Id: Folder.py,v 1.62 1999/02/15 23:10:19 brian Exp $""" $Id: Folder.py,v 1.63 1999/02/16 15:55:43 brian Exp $"""
__version__='$Revision: 1.62 $'[11:-2] __version__='$Revision: 1.63 $'[11:-2]
import Globals, SimpleItem, Acquisition, mimetypes, content_types import Globals, SimpleItem, Acquisition, mimetypes, content_types
from Globals import HTMLFile from Globals import HTMLFile
...@@ -182,7 +182,7 @@ class Folder(ObjectManager, PropertyManager, RoleManager, SimpleItem.Item, ...@@ -182,7 +182,7 @@ class Folder(ObjectManager, PropertyManager, RoleManager, SimpleItem.Item,
'manage_cutObjects', 'manage_copyObjects', 'manage_pasteObjects', 'manage_cutObjects', 'manage_copyObjects', 'manage_pasteObjects',
'manage_renameForm', 'manage_renameObject', 'manage_renameForm', 'manage_renameObject',
'manage_findFrame', 'manage_findForm', 'manage_findAdv', 'manage_findFrame', 'manage_findForm', 'manage_findAdv',
'manage_findResult', 'manage_findOpt')), 'manage_findResult')),
('Access contents information', ('Access contents information',
('objectIds', 'objectValues', 'objectItems','hasProperty', ('objectIds', 'objectValues', 'objectItems','hasProperty',
'propertyIds', 'propertyValues','propertyItems',''), 'propertyIds', 'propertyValues','propertyItems',''),
...@@ -293,17 +293,22 @@ class Folder(ObjectManager, PropertyManager, RoleManager, SimpleItem.Item, ...@@ -293,17 +293,22 @@ class Folder(ObjectManager, PropertyManager, RoleManager, SimpleItem.Item,
manage_importExportForm=HTMLFile('importExport',globals()) manage_importExportForm=HTMLFile('importExport',globals())
def manage_importObject(self,file,REQUEST=None): def manage_importObject(self, file, REQUEST=None):
"Import an object from a file" """Import an object from a file"""
if find(file,'..') != -1: dirname, file=os.path.split(file)
raise ValueError, 'Bad file name %s' % file if dirname:
f=os.path.join(INSTANCE_HOME,'Import',file) raise 'Bad Request', 'Invalid file name %s' % file
o=self._p_jar.import_file(f) file=os.path.join(INSTANCE_HOME, 'import', file)
id=o.id if not os.path.exists(file):
if hasattr(id,'im_func'): id=id() raise 'Bad Request', 'File does not exist: %s' % file
self._setObject(id,o) ob=self._p_jar.import_file(file)
if REQUEST: self._verifyObjectPaste(ob, REQUEST)
id=ob.id
if hasattr(id, 'im_func'): id=id()
self._setObject(id, ob)
if REQUEST is not None: if REQUEST is not None:
return MessageDialog(title='Object imported', return MessageDialog(
title='Object imported',
message='<EM>%s</EM> sucessfully imported' % id, message='<EM>%s</EM> sucessfully imported' % id,
action='manage_main' action='manage_main'
) )
......
...@@ -40,9 +40,9 @@ on the server. ...@@ -40,9 +40,9 @@ on the server.
<P> <P>
You may import Zope objects which have been previously You may import Zope objects which have been previously
exported to a file, by placing the file in the &quot;Import&quot; exported to a file, by placing the file in the &quot;import&quot;
directory of your Zope installation on the server. You should create directory of your Zope installation on the server. You should create
the &quot;Import&quot; directory in the root of your Zope installation the &quot;import&quot; directory in the root of your Zope installation
if it does not yet exist. if it does not yet exist.
</P> </P>
......
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