[Zope] Searching a FieldIndex by ZPT

Andre Meyer a.meyer at hccnet.nl
Sun Mar 14 11:29:54 EST 2004


Hi Zopers

So, I finally managed to search a FieldIndex in my Catalog in Python 
like this:

            request = {'year_of_birth_index':{'query':[1000, 1500], 
'range': 'minmax'}}
            obj = self.Catalog.search(request)

            print obj.__len__(), 'objects found'
            for i in range(obj.__len__()):
                print i , obj.__getitem__(i).title, 
obj.__getitem__(i).getObject().year_of_birth

Now I want to do the exact same thing in ZPT, but get no results, why?

        <form action="index_report" method="get">
            <table>
                <tr><th>Search Year of Birth</th>
                    <td><input name="year_of_birth_index.query:record" 
width=30 value="1000, 1500"></td></tr>
                <input type="hidden" 
name="year_of_birth_index.range:record" value="minmax">
                <tr><td colspan=2 align=center>
                    <input type="SUBMIT" value="Submit Query">
                </td></tr>
            </table>
        </form>

Another detail: when I get results in the report form via "results 
here/Catalog" and put them in a batch, how do I get the total length of 
the results? It is a LazyCat and __len__() does not seem to work.

thanks
kind regards
Andre





More information about the Zope mailing list