[Zope] ZCatalog (2.3.1) won't acquire method from parent folder?
andres@corrada.com
andres@corrada.com
Fri, 11 May 2001 21:43:54 -0400
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
------------------------------------------------------