The first step in any search is to set up the catalog. There is no difference in setting up a catalog for "normal" searches and setting one up for a search of SQL data, so I'm not going to go into detail here on how to do that. Just make sure you have created a catalog with the desired indexes and meta data.
==============
So i just used the chapter 9 reference that was provided earlier and i created a ZCatalog called Products. I was not sure what else to do so i just let the defaults remain as it is - the AnimalTracker example in chap 9 didnt seem relevant to me since i have no dtml methods to search for - only products info from the postgres. So i just didnt do anything further. I have a products table in the postgres rdbms that i want to search by title and description. So after this i created a zsql method called getProdtoCatalog under the ZCatalog itself - the query i used is
SELECT prodid as Number, Title,
Descr || ' ' || Title as
PrincipiaSearchSource,
'Product' as meta_type, prodid as id, Descr as
summary
FROM products
Now i went into the Find Objects section and searched for the getProdtoCatalog zsql method and added to the catalog
Next i went and created the python script (again under the Products ZCatalog itself) and i called it catalogProducts this is the code inside
for book in container.getProdToCatalog():
container.catalog_object(Product,
'/learn/search/Products/'+Product.Number+'/proddetails.html')
print 'Product #' + Product.Number
return printed
The moment i test it i run into trouble - Can any one help please
regards
bobby
For the error message this is what i get....
===================
Zope ErrorZope has encountered an error while publishing this resource. Error Type: AttributeError Troubleshooting Suggestions
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. |
Traceback (innermost last):
File /home/bobby/Zope-2.3/lib/python/ZPublisher/Publish.py, line 222, in publish_module
File /home/bobby/Zope-2.3/lib/python/ZPublisher/Publish.py, line 187, in publish
File /home/bobby/Zope-2.3/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook
(Object: Traversable)
File /home/bobby/Zope-2.3/lib/python/ZPublisher/Publish.py, line 171, in publish
File /home/bobby/Zope-2.3/lib/python/ZPublisher/mapply.py, line 160, in mapply
(Object: catalogProducts)
File /home/bobby/Zope-2.3/lib/python/ZPublisher/Publish.py, line 112, in call_object
(Object: catalogProducts)
File /home/bobby/Zope-2.3/lib/python/Shared/DC/Scripts/Bindings.py, line 324, in __call__
(Object: catalogProducts)
File /home/bobby/Zope-2.3/lib/python/Shared/DC/Scripts/Bindings.py, line 353, in _bindAndExec
(Object: catalogProducts)
File /home/bobby/Zope-2.3/lib/python/Products/PythonScripts/PythonScript.py, line 330, in _exec
(Object: catalogProducts)
(Info: ({'script': <PythonScript instance at 88d81b0>, 'context': <ZCatalog instance at 8d02630>, 'container': <ZCatalog instance at 8d02630>, 'traverse_subpath': []}, (), {}, None))
File Script (Python), line 2, in catalogProducts
File /home/bobby/Zope-2.3/lib/python/Products/PythonScripts/Guarded.py, line 273, in __getattr__
File /home/bobby/Zope-2.3/lib/python/Products/PythonScripts/Guarded.py, line 143, in __careful_getattr__
(Object: Traversable)
AttributeError: (see above)
===================