[Zope-Checkins] SVN: Zope/trunk/src/OFS/ObjectManager.py Extract _getImportPaths method.

Stefan H. Holek stefan at epy.co.at
Sat Mar 7 16:16:38 EST 2009


Log message for revision 97639:
  Extract _getImportPaths method.

Changed:
  U   Zope/trunk/src/OFS/ObjectManager.py

-=-
Modified: Zope/trunk/src/OFS/ObjectManager.py
===================================================================
--- Zope/trunk/src/OFS/ObjectManager.py	2009-03-07 20:50:40 UTC (rev 97638)
+++ Zope/trunk/src/OFS/ObjectManager.py	2009-03-07 21:16:37 UTC (rev 97639)
@@ -618,7 +618,7 @@
             raise BadRequest, 'Invalid file name %s' % escape(file)
 
         cfg = getConfiguration()
-        for impath in (cfg.instancehome, getattr(cfg, 'zopehome', '')):
+        for impath in self._getImportPaths():
             filepath = os.path.join(impath, 'import', file)
             if os.path.exists(filepath):
                 break
@@ -655,8 +655,7 @@
         ob=self._getOb(id)
         ob.manage_changeOwnershipType(explicit=0)
 
-    def list_imports(self):
-        listing = []
+    def _getImportPaths(self):
         cfg = getConfiguration()
         paths = []
         zopehome = getattr(cfg, 'zopehome', None)
@@ -664,7 +663,11 @@
             paths.append(zopehome)
         if not cfg.instancehome in paths:
             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')
             if not os.path.isdir(directory):
                 continue



More information about the Zope-Checkins mailing list