ZCatalog (2.3.1) won't acquire method from parent folder?
Running Zope 2.3.1; A ZCatalog instance that I have won't acquire a method from the parent folder it resides in; I get a NameError on the method. This is very strange. The method is called from another method whose results are supposed to be indexed. +Zope Root +Classifieds (Container, Subclassed from Folder, contains a method called iterateText(self, text, times)) Catalog (ZCatalog) I have a text index set up for a method called searchTextWeighted, which is a DTML template file on disk within a python product. Inside searchTextWeighted, I have the following DTML: <dtml-var expr="iterateText(getTitleExpanded(), 5)"> iterateText is a method of a python class that is subclassed from ZCatalog.CatalogAware and OFS.Folder.Folder: def iterateText(self, text, times): """Repeats output of text times # of lines for # of times""" result='' times=int(times) for item in range(times): result=result+text+'\n' return result I get a name error for iterateText upon trying to add a catalog-Aware class, when index_objects() is run (I just made this class Catalog-aware). This is weird, since, in terms of namespaces, iterateText is in a folder above the Catalog, and also above the item I am trying to ad, so no matter how you look at it, iterateText should be acquired, and not generate a Name Error. In testing this out, I am able to traverse to iterateText via URL in a browser with no problems. I assume that this is not related to the ZCatalog bug in 2.3.1 where the Catalog won't run a method requiring arguments. The method in the index, searchTextWeighted, passes all the arguments needed by iterateText in the DTML. So I am a bit confused here. Traceback is below. ------------------------ Traceback (innermost last): File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/lib/zope/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: manage_addAdItem) File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: manage_addAdItem) File /usr/lib/zope/lib/python/Products/DailyClassifieds/item.py, line 251, in manage_addAdItem File /usr/lib/zope/lib/python/OFS/ObjectManager.py, line 302, in _setObject (Object: Traversable) File /usr/lib/zope/lib/python/Products/ZCatalog/CatalogAwareness.py, line 114, in manage_afterAdd (Object: CatalogAware) File /usr/lib/zope/lib/python/Products/ZCatalog/CatalogAwareness.py, line 184, in index_object (Object: CatalogAware) File /usr/lib/zope/lib/python/Products/ZCatalog/ZCatalog.py, line 429, in catalog_object (Object: Traversable) File /usr/lib/zope/lib/python/Products/ZCatalog/Catalog.py, line 448, in catalogObject File /usr/lib/zope/lib/python/SearchIndex/UnTextIndex.py, line 323, in index_object File /usr/lib/zope/lib/python/App/special_dtml.py, line 127, in __call__ (Object: searchTextWeighted) File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line 538, in __call__ (Object: searchTextWeighted) File /usr/lib/zope/lib/python/DocumentTemplate/DT_Util.py, line 334, in eval (Object: iterateText(getTitleExpanded(), 5)) (Info: iterateText) File <string>, line 0, in ? NameError: (see above) ---------------------- Sean ========================= Sean Upton Senior Programmer/Analyst SignOnSanDiego.com The San Diego Union-Tribune 619.718.5241 sean.upton@uniontrib.com =========================
Hi, I'm being a bit impish here, but what is your acquisition path for iterateText? Are there any ids that start with numbers? On Fri, May 11, 2001 at 04:43:33PM -0700, sean.upton@uniontrib.com wrote:
Running Zope 2.3.1; A ZCatalog instance that I have won't acquire a method from the parent folder it resides in; I get a NameError on the method. This is very strange. The method is called from another method whose results are supposed to be indexed.
+Zope Root +Classifieds (Container, Subclassed from Folder, contains a method called iterateText(self, text, times)) Catalog (ZCatalog)
I have a text index set up for a method called searchTextWeighted, which is a DTML template file on disk within a python product. Inside searchTextWeighted, I have the following DTML: <dtml-var expr="iterateText(getTitleExpanded(), 5)">
iterateText is a method of a python class that is subclassed from ZCatalog.CatalogAware and OFS.Folder.Folder:
def iterateText(self, text, times): """Repeats output of text times # of lines for # of times""" result='' times=int(times) for item in range(times): result=result+text+'\n' return result
I get a name error for iterateText upon trying to add a catalog-Aware class, when index_objects() is run (I just made this class Catalog-aware). This is weird, since, in terms of namespaces, iterateText is in a folder above the Catalog, and also above the item I am trying to ad, so no matter how you look at it, iterateText should be acquired, and not generate a Name Error. In testing this out, I am able to traverse to iterateText via URL in a browser with no problems.
I assume that this is not related to the ZCatalog bug in 2.3.1 where the Catalog won't run a method requiring arguments. The method in the index, searchTextWeighted, passes all the arguments needed by iterateText in the DTML. So I am a bit confused here.
Traceback is below.
------------------------
Traceback (innermost last): File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/lib/zope/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: manage_addAdItem) File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: manage_addAdItem) File /usr/lib/zope/lib/python/Products/DailyClassifieds/item.py, line 251, in manage_addAdItem File /usr/lib/zope/lib/python/OFS/ObjectManager.py, line 302, in _setObject (Object: Traversable) File /usr/lib/zope/lib/python/Products/ZCatalog/CatalogAwareness.py, line 114, in manage_afterAdd (Object: CatalogAware) File /usr/lib/zope/lib/python/Products/ZCatalog/CatalogAwareness.py, line 184, in index_object (Object: CatalogAware) File /usr/lib/zope/lib/python/Products/ZCatalog/ZCatalog.py, line 429, in catalog_object (Object: Traversable) File /usr/lib/zope/lib/python/Products/ZCatalog/Catalog.py, line 448, in catalogObject File /usr/lib/zope/lib/python/SearchIndex/UnTextIndex.py, line 323, in index_object File /usr/lib/zope/lib/python/App/special_dtml.py, line 127, in __call__ (Object: searchTextWeighted) File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line 538, in __call__ (Object: searchTextWeighted) File /usr/lib/zope/lib/python/DocumentTemplate/DT_Util.py, line 334, in eval (Object: iterateText(getTitleExpanded(), 5)) (Info: iterateText) File <string>, line 0, in ? NameError: (see above) ----------------------
Sean
========================= Sean Upton Senior Programmer/Analyst SignOnSanDiego.com The San Diego Union-Tribune 619.718.5241 sean.upton@uniontrib.com =========================
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- ------------------------------------------------------ Andres Corrada-Emmanuel Email: andres@corrada.com ------------------------------------------------------
sean.upton@uniontrib.com wrote:
Running Zope 2.3.1; A ZCatalog instance that I have won't acquire a method
I may be 'speaking out of turn' here (a good southern US expression). But IMHO, anyone that is using 2.3.1 and having any kind of problems, should run, don't walk, to upgrade to 2.3.2.
From my experience and from posts on this list I think this is a very prudent move.
-- Tim Cook, President - FreePM,Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
On 11 May 2001 21:16:54 -0500, Tim Cook wrote:
sean.upton@uniontrib.com wrote:
Running Zope 2.3.1; A ZCatalog instance that I have won't acquire a method
I may be 'speaking out of turn' here (a good southern US expression). But IMHO, anyone that is using 2.3.1 and having any kind of problems, should run, don't walk, to upgrade to 2.3.2.
From my experience and from posts on this list I think this is a very prudent move.
With the exception that 2.3.2 BREAKS a few things. Some have noted that due to some changes (ie. in at least one case a move of a file), 2.3.2 breaks login manager. Bill
Bill Anderson wrote:
With the exception that 2.3.2 BREAKS a few things. Some have noted that due to some changes (ie. in at least one case a move of a file), 2.3.2 breaks login manager.
Arrgh! I missed that. But then I don't use login manager. Guess I should have been more specific. 2.3.1 breaks just about everything that uses CatalogAware ZClasses. If you use login manager don't upgrade to 2.3.2 <s> Zope is still a great tool! <s> -- Tim Cook, President - FreePM,Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
participants (4)
-
andres@corrada.com -
Bill Anderson -
sean.upton@uniontrib.com -
Tim Cook