Re: [Zope3-Users] zope.app.catalog doc question
On Tue, 2005-10-18 at 08:12 -0400, Stephan Richter wrote: > On Friday 30 September 2005 15:52, Duncan McGreggor wrote: > > since apply() does expect the rhs of the parameter to be a sequence. > > With this change, my code now works (no errors, anyway), but I wanted > > to see if this was a misunderstanding on my part or a documentation > > typo... > > If the above is a doctest it will actually work, but I don't know why. I > think > this is a good issue to bring up on zope3-dev or even file an issue for it. > If I remember correctly I didn't have this problem with Text indexes, i.e. rhs of the search parameter didn't have to be a list, but when if I searched a Field index I had a similar issue as Duncan and had to make rhs a list. I am using catalog searchResults() method rather than apply(). Regards Alen ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zope.app.catalog doc question
On Friday 30 September 2005 15:52, Duncan McGreggor wrote: > since apply() does expect the rhs of the parameter to be a sequence. > With this change, my code now works (no errors, anyway), but I wanted > to see if this was a misunderstanding on my part or a documentation > typo... If the above is a doctest it will actually work, but I don't know why. I think this is a good issue to bring up on zope3-dev or even file an issue for it. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] zope.app.catalog doc question
I am curious about the documented catalog method searchResults(). Starting at line 223 of zope/app/catalog/README.txt (3.1 rc3 download, not svn co), there is the following usage of the method: >>> result = cat.searchResults(size=5) >>> len(result) 2 >>> list(result) == [o4, o5] True When trying to implement this with my own catalog, I got the following (partial) traceback: File "/Users/oubiwann/Desktop/2CD/AdytumSolutions/Projects/Zope3Work/ zope310_r3/lib/python/accumacsite/browser/homepageview.py", line 18, in inventoryInStock return catalog.searchResults(equipment_in_stock=True) File "/usr/local/zope310/lib/python/zope/app/catalog/catalog.py", line 105, in searchResults results = self.apply(searchterms) File "/usr/local/zope310/lib/python/zope/app/catalog/catalog.py", line 84, in apply r = index.apply(index_query) File "/usr/local/zope310/lib/python/zope/index/field/index.py", line 99, in apply return multiunion(self._fwd_index.values(*query)) TypeError: values() argument after * must be a sequence Indeed, after looking at the code, it seems that instead of writing this: return catalog.searchResults(equipment_in_stock=True) I should be writing this: return catalog.searchResults(equipment_in_stock=[True]) since apply() does expect the rhs of the parameter to be a sequence. With this change, my code now works (no errors, anyway), but I wanted to see if this was a misunderstanding on my part or a documentation typo... Thanks, Duncan ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users