[Zope] ZCatalog inside ZClass - AttributeError when adding index

Juergen R. Plasser / HEXAGON plasser@hexagon.at
Thu, 31 Jan 2002 16:00:55 +0100


Hi all,

when I create a ZCatalog instance inside my ZClass container (as described 
in http://www.zope.org/Members/Zen/tips/tip_ZCatalogInZClass) I get an 
AttributeError.

Here is snapshot of my code in the myclass_add DTML method:

>>>

<dtml-call 
"manage_addProduct['ZCatalog'].manage_addZCatalog('Catalog','','create_defa
ult_catalog_',REQUEST)">

  <dtml-with "Catalog">
    <dtml-call "manage_delColumns(['summary',],REQUEST,RESPONSE,URL1)">

    <dtml-call "manage_addColumn('test',REQUEST,RESPONSE,URL1)">
    <dtml-call "manage_addIndex('test','FieldIndex',REQUEST,RESPONSE,URL1)">

  </dtml-with>

<<<

The problem seems to be  the manage_addIndex method. What am I doing wrong? 
When I change the given dtml-call into

<dtml-call "manage_addIndex('test','FieldIndex',None)">

everything works fine. Am I missing something or is this the right way?

Here is the trace:

>>>
Zope has encountered an error while publishing this resource.

Error Type: AttributeError
Error Value: redirect



---------------------------------------------------------------------------
-----

Troubleshooting Suggestions

The URL may be incorrect.
The parameters passed to this resource may be incorrect.
A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the HTML 
source for this page.

If the error persists please contact the site maintainer. Thank you for 
your patience.


 View Source

Traceback (innermost last):
  File 
/var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/ZPublisher/Publish.py, line 
223, in publish_module
  File 
/var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/ZPublisher/Publish.py, line 
187, in publish
  File /var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/Zope/__init__.py, 
line 226, in zpublisher_exception_hook
    (Object: myclass_factory)
  File 
/var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/ZPublisher/Publish.py, line 
171, in publish
  File /var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/ZPublisher/mapply.py, 
line 160, in mapply
    (Object: myclass_add)
  File 
/var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/ZPublisher/Publish.py, line 
112, in call_object
    (Object: myclass_add)
  File /var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/OFS/DTMLMethod.py, 
line 199, in __call__
    (Object: myclass_add)
  File 
/var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/DocumentTemplate/DT_String.p
y, line 546, in __call__
    (Object: myclass_add)
  File 
/var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/DocumentTemplate/DT_With.py, 
line 148, in render
    (Object: myclass.createInObjectManager(REQUEST['id'], REQUEST))
  File 
/var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/DocumentTemplate/DT_With.py, 
line 148, in render
    (Object: Catalog)
  File 
/var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/DocumentTemplate/DT_Util.py, 
line 231, in eval
    (Object: manage_addIndex('test','FieldIndex',REQUEST,RESPONSE,URL1))
    (Info: manage_addIndex)
  File <string>, line 2, in f
  File 
/var/lib/zope/Zope-2.4.1-linux2-x86/lib/python/Products/ZCatalog/ZCatalog.p
y, line 452, in manage_addIndex
    (Object: Catalog)
AttributeError: (see above)
<<<

Thanks for your time,
Juergen