[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
[Zope3-Users] How do I logout from Zope 3 Management Interface?
I have installed Zope 3.1 rc 3. After logging in, I could not find any logout button. Is it OK to directly shut the browser window ( I am using Firefox)? --mk ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] querying the catalog
I think I understand now, you have a page view index.html with view class HomePageView which looks up a catalog but when you go to the page: /accumac/index.html the local catalog /accumac/++etc++site/default/accumac_catalog is not being found, but a catalog in the root site is returned. Unfortunately not sure why this would be happening, I would definitely expect the local catalog to be returned first. Not sure if it will help but whenever I had to look up a catalog I would only do zapi.getUtility(ICatalog) and I noticed you are also providing a name and context. Maybe you need to do this as you have more than one catalog in your ++etc++site. I think another thing to make sure is that your local catalog provides ICatalog interface. I also believe that if you are looking up a catalog by name as you seem to be doing it is not enought for the catalog object to be named accumac_catalog but you also have to register it as the name ('Register As' field in New Utility Registration) during catalog creation. I usually leave 'Register As' blank as I only ever needed to get catalog by ICatalog interface only - zapi.getUtility(ICatalog) Alen On Fri, 2005-09-30 at 19:25 -0600, Duncan McGreggor wrote: On Sep 30, 2005, at 7:17 PM, Alen Stanisic wrote: My understanding was that your zapi.getUtility() was not finding your catalog and that you had three parallel sites from which you were doing the catalog look up and the catalog was only in one of them, accumac site: /accumac/++etc++site/default/accumac_catalog I guess the success of the catalog look up depends on what your self.context is when you are doing zapi.getUtility(), i.e. where you are looking up the catalog from. I would expect your code to find the catalog when self.context is inside accumac site, but would not expect the catalog to be found from inside the other two sites. Okay, that's what I thought you were talking about. So, to clarify, I am not interesting in finding any content outside of the subs-sites; they are little units in and of themselves, and content searches take place only within the context of a subsite. The problem is (using a specific example) that the catalog in the subsite accumac is not being found. That's the one I want found, and only within the context of the accumac site itself. It *is* finding a catalog, though not the one I want. The one it is finding is at /++etc++site/default (and not /accumac/++etc++site/default). Thanks for taking the time to understand :-) d ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users