Commit ea10a300 authored by Stefan H. Holek's avatar Stefan H. Holek

Extract _getImportPaths method.

parent ca01cd0a
...@@ -618,7 +618,7 @@ class ObjectManager(CopyContainer, ...@@ -618,7 +618,7 @@ class ObjectManager(CopyContainer,
raise BadRequest, 'Invalid file name %s' % escape(file) raise BadRequest, 'Invalid file name %s' % escape(file)
cfg = getConfiguration() cfg = getConfiguration()
for impath in (cfg.instancehome, getattr(cfg, 'zopehome', '')): for impath in self._getImportPaths():
filepath = os.path.join(impath, 'import', file) filepath = os.path.join(impath, 'import', file)
if os.path.exists(filepath): if os.path.exists(filepath):
break break
...@@ -655,8 +655,7 @@ class ObjectManager(CopyContainer, ...@@ -655,8 +655,7 @@ class ObjectManager(CopyContainer,
ob=self._getOb(id) ob=self._getOb(id)
ob.manage_changeOwnershipType(explicit=0) ob.manage_changeOwnershipType(explicit=0)
def list_imports(self): def _getImportPaths(self):
listing = []
cfg = getConfiguration() cfg = getConfiguration()
paths = [] paths = []
zopehome = getattr(cfg, 'zopehome', None) zopehome = getattr(cfg, 'zopehome', None)
...@@ -664,7 +663,11 @@ class ObjectManager(CopyContainer, ...@@ -664,7 +663,11 @@ class ObjectManager(CopyContainer,
paths.append(zopehome) paths.append(zopehome)
if not cfg.instancehome in paths: if not cfg.instancehome in paths:
paths.append(cfg.instancehome) paths.append(cfg.instancehome)
for impath in paths: return paths
def list_imports(self):
listing = []
for impath in self._getImportPaths():
directory = os.path.join(impath, 'import') directory = os.path.join(impath, 'import')
if not os.path.isdir(directory): if not os.path.isdir(directory):
continue continue
......
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