[Zope-CVS] CVS: Products/PathIndexNG - PathIndexNG.py:1.3

Andreas Jung andreas at andreas-jung.com
Sat Jan 24 12:28:39 EST 2004


Update of /cvs-repository/Products/PathIndexNG
In directory cvs.zope.org:/tmp/cvs-serv12722

Modified Files:
	PathIndexNG.py 
Log Message:
cleanup and fixes


=== Products/PathIndexNG/PathIndexNG.py 1.2 => 1.3 ===
--- Products/PathIndexNG/PathIndexNG.py:1.2	Sat Jan 24 12:14:15 2004
+++ Products/PathIndexNG/PathIndexNG.py	Sat Jan 24 12:28:38 2004
@@ -13,7 +13,7 @@
 
 __version__ = '$Id$'
 
-from types import StringType, ListType, TupleType
+from types import StringType
 
 import ZODB
 from Globals import Persistent, DTMLFile
@@ -55,29 +55,13 @@
         self._unindex = IOBTree()     # docid -> path
 
     def index_object(self, docid, obj ,threshold=100):
-        """ hook for (Z)Catalog """
-
-        f = getattr(obj, self.id, None)
-        if f is not None:
-            if safe_callable(f):
-                try:
-                    path = f()
-                except AttributeError:
-                    return 0
-            else:
-                path = f
+      
+        path = obj.getPhysicalPath()
+        if not isinstance(path, StringType):
+            path = '/'.join(path)
+        if not path.startswith('/'):
+            path = '/' + path
 
-            if not isinstance(path, (StringType, TupleType)):
-                raise TypeError('path value must be string or tuple of strings')
-        else:
-            try:
-                path = obj.getPhysicalPath()
-            except AttributeError:
-                return 0
-
-        if isinstance(path, (ListType, TupleType)):
-            path = '/'+ '/'.join(path[1:])
-       
         if not self._unindex.has_key(docid):
             self._length.change(1)
 
@@ -158,7 +142,7 @@
     manage_workspace = DTMLFile('dtml/managePathIndexNG', globals())
 
 
-manage_addPathIndexNGForm = DTMLFile('dtml/addPathNGIndex', globals())
+manage_addPathIndexNGForm = DTMLFile('dtml/addPathIndexNG', globals())
 
 def manage_addPathIndexNG(self, id, REQUEST=None, RESPONSE=None, URL3=None):
     """Add a path index"""




More information about the Zope-CVS mailing list