Problems with ZCatalog method
I am a relatively new zope user so you'll have to excuse me. I am trying to write a python script that will automatically recatalog my Zcatalog. Unfortunately I keep getting an error that I can't get past. Here is a code snippet with some minor changes to protect the innocent: request = container.REQUEST RESPONSE = request.RESPONSE url1 = 'http://localhost:4444/myCatalog' url2 = 'http://localhost:4444/' obj_metatypes=['Page Template'] obj_expr='not noindex' obj_ids='None' obj_searchterm='None' obj_mtime='None' obj_mspec='None' obj_roles='None' obj_permission='None' monkey=[obj_metatypes, obj_ids, obj_searchterm, obj_expr, obj_mtime, obj_mspec, obj_roles, obj_permission] container.GALEN_Catalog.manage_catalogClear() container.GALEN_Catalog.manage_catalogFoundItems(request, RESPONSE, url2, url1, monkey) # I have also just tried obj_metatypes=['Page Template'], obj_expr='not noindex' instead of the monkey list I get an indexError: List index out of range. Here is the traceback: Traceback (innermost last): Module ZPublisher.Publish, line 98, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module Shared.DC.Scripts.Bindings, line 252, in __call__ Module Shared.DC.Scripts.Bindings, line 283, in _bindAndExec Module Products.PythonScripts.PythonScript, line 315, in _exec Module Script (Python), line 22, in cron_test.py - <PythonScript at /cron_test.py> - Line 22 Module Products.ZCatalog.ZCatalog, line 306, in manage_catalogFoundItems IndexError: list index out of range line 306 in ZCatalog is: obj = REQUEST.PARENTS[1] This is where I get stuck. Here is more software/platform info: Zope Version (Zope 2.6.1 (source release, python 2.1, linux2), python 2.1.3, sunos5) Python Version 2.1.3 (#1, Jul 12 2002, 11:06:12) [GCC 2.95.2 19991024 (release)] System Platform sunos5 Any help on this would be appreciated. Cheers, Jason Randell
Jason Randell wrote at 2004-1-8 09:58 -0800:
I am trying to write a python script that will automatically recatalog my Zcatalog. Unfortunately I keep getting an error that I can't get past. Here is a code snippet with some minor changes to protect the innocent: ... container.GALEN_Catalog.manage_catalogFoundItems(request, RESPONSE, url2, url1, monkey)
# I have also just tried obj_metatypes=['Page Template'], obj_expr='not noindex' instead of the monkey list
I get an indexError: List index out of range. Here is the traceback: Traceback (innermost last): .... - <PythonScript at /cron_test.py> - Line 22 Module Products.ZCatalog.ZCatalog, line 306, in manage_catalogFoundItems IndexError: list index out of range
line 306 in ZCatalog is: obj = REQUEST.PARENTS[1]
"manage_catalogFoundItems" expects to be called via the Web only. Iterate over the list of objects you want to catalog and call "catalog_object" on them. -- Dieter
participants (2)
-
Dieter Maurer -
Jason Randell