[Zope] ZCatalog and dictionary python instances variables (QUEST)

Oscar Picasso picasso@videotron.ca
Sun, 09 Apr 2000 01:03:34 -0400


> > 
> > Before Cataloging my object I run:
> > <dtml-call "multi.set()">
> 
> Just to make sure you know, python classes can define an __init__ method
> to initialize attributes like this.

I know it, but in that case I didn't want to use __init__.


> > But it never works.
> > 
> > Any help greatly appreciated.
> 
> I'd like to help, but 'But it never works' is just not enough detail for
> me or anyone else to even begin to help you.
>
> _How_ does it never work?
> 

When i make a search i get "There is no data matching this Myfolder query". See
different tests below.

> Does it tell you an error?
> 
> If there is an error, do you get a traceback?

No error, no traceback. Neither when cataloging, neither when searching.

> 
> Does nothing happen?
> 
> By default, nothing will happen if it _does_ work.  What are you
> searching for in this case to try and match your dictionary value?  How
> are you searching?  How does this not return what you expect?

I try to search all the object where b['one'] = 'un'. I use the input form
generated by the ZSearch interface.

I typed 'un' in the b field of the input form 
#as expected i got "There is no data matching this Myfolder query"

I type 'un' in the b['one'] filed of the input form
#i expected one object to be returned i got "There is no data matching this Myfolder query"


> Obviously a TextIndex is not what you want, that's for indexing
> documents of text, and trying to text index a dictionary will be ignored
> by the Catalog. So we can discard that part of your problem right off. 
> FieldIndexes index a value to a sequence of documents, and that value
> can be any python object.  So a FieldIndex should work just fine in this
> case.
> 
> -Michel

Maybe my example was bad but some values of my dictionary could be long
text. That's why I also try it with Textfield. But forget the Textfield.


Here other details of what i have done:
**Metatables**
b
a
b['one']

**Indexes**
b
a
b['one']


I then used Find objects to catalog (i have just one for the test).
**Status**
1 object are in b
1 object are in a
1 object are in b['one']

I created a ZSearch Interface.

Then: 

Test1.
in my input form
b = 'un'
(other fields empty)
result ====> "There is no data matching this Myfolder query".

Test2
in the input form
a=a_content
result =====>
b = the b dictionary
a = a_content
b['one']     #here i expected b['one'] = 'un'


Test 3
in the input form
b['one'] = 'un'
other fields empty.
result ====> "There is no data matching this Myfolder query".


And i am sure the content of b['one'] is 'un'. (I tried my_instance['one'], and
got 'un' as expected).

It seem that when caloging, ZCatalog didn't "find" the b['one'] element.
Bad syntax?

Hope i have given enough details and thanks again for your patience.


Oscar