Andreas Jung wrote:

--On 5. März 2008 10:21:32 +0100 Yuri <[EMAIL PROTECTED]> wrote:

Hi, all!

 I would like to define a class inside a python script (so I can catalog
it and use catalog to store info, as the tutorial about catalog
everything suggests).

This is basically bad-style. Define your class somewhere in your product code and if necessary make it available through related APIs of the AccessControl module.

I've found this:


If you have a KeywordIndex for the attribute 'foo', then you need to
arrange that the reult objects in your recordset have sequences for the
column / atrribute 'foo'. E.g., for a query like:

select as 'bar, as 'name', as 'foo
from bar, foo where foo.bar_id =

you need to transform the result set:

bars = {}
for row in rows:
bar_id= row['bar']
bar = bars.get(bar_id)
if bar is None:
bar = bars[bar_id[ = {'bar': bar_id,
'name': row['name'],
'foo': [],

*Now* you can index the records you have transformed:

for bar in bars.values():
catalog.indexObject(compute_uid(bar), make_record(bar))


what are compute_uid(bar) and make_record(bar)?

btw, indexes "calls" the object I pass to indexObject or catalog_object, so I need an object with methods or a dictionary is enough? I'm testing it, but it is not...


def ret_autore(self):
"ritorna un autore"

return 'prova'

un_autore = {}
#the index is called autore
un_autore.autore = ret_autore

context.catalogo_autori.catalog_object(un_autore, un_autore['aut'])



*Error Type: TypeError*
*Error Value: object has read-only attributes*
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to