Hi Andreas,

what I'm trying to do is indexing in a Catalog some Folder objects manipulating 
some properties.

If I assign to the request the new key value everything works as expected.
For instance:
req=context.REQUEST

for obj in context.objectValues('Folder'):
        req.set('city', obj.city+' '+obj.province)
        req.set('id', ('/').join(obj.getPhysicalPath()))
        container.MyCatalog.catalog_object(req,req['id'])

I was just wondering why I am not able to get the same results (only the id get 
indexed but not the city) building and indexing dictionaries in the following 
way:

for obj in context.objectValues('Folder'):
        D={}
        D['id'] =  ('/').join(obj.getPhysicalPath())
        D['city'] = obj.city+' '+obj.province
        container.MyCatalog.catalog_object(D,D['id'])

And yes, the indexes name are the same and they are listed in the catalog.

P.S. I know i can assign multiple attributes to an index in the catalog, still 
I wonder why the above code doesn't work.

Thanks for your help,


G.

On Aug 6, 2012, at 07:24 31, Andreas Jung wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> 
> Giampiero Benvenuti wrote:
>> Hello!
>> 
>> can you please give me some hints on how to catalog a list of
>> dictionaries? Is it possible?
> 
> What have you tried? What exactly is not working?
>> 
>> L= [{'id':'1','lastName':'Rossi','firstName':'Mario'}, {...), etc..]
>> 
>> for d in L: context.Mycatalog.catalog_object( d, d['id'])
>> 
>> 
> Are you use that you created the related indexes that you are using for
> indexes?
> 
> Please provide a reasonable description of the problem (if you have one).
> 
> - -aj
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iQGUBAEBAgAGBQJQH1UOAAoJEADcfz7u4AZjbbwLwIj/kqgzC8DazRlomyO4Auv0
> B751yKOSYWo+v6j1Ren8SFfuImie3d98oaOp5w2RHL7TyqDU9iEbfDFhTjKmFE9t
> KeihBckCkBcsquE04Uih5vnKNVh1IOZhD6VB0yebtr4776bm7HBXi4b8ZVfWjH1Z
> NV8HBMRku+0f4M0X8MyWGETSat5wCBO8WnnoYCsHGxpE2VNvgYAIk8LcXGdZsExa
> HGEFmmXJy1Z8NAMrGPMQurw9JfBrC7LWDd4feEmXMw6az06kkZWNnp42Zp9YLzcR
> tBMwigyZLMNOO9Tt+s+orGKWbKzKxoGqU1/uxGngpR+8/n4bYgFv86/46QwvMFqF
> ScInrrYwufvqQUo9jks4HDv+BoRg6v1tUkKipu50ICXk7f1nwRsSy0OGDGmSegN+
> JeGcFvUCJb2y0t6/ruBNTiM8Gf1cKr50Z6M5I+lG09Hoyl0iyYwdJu0s8RoGMTOQ
> WAYeUXCbzu/CKevZIcXvU6qP/mx5Bfc=
> =XvKh
> -----END PGP SIGNATURE-----
> <lists.vcf>

_______________________________________________
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to