From: Jonathan <dev101@...>
targetFolder = string.join(traverse_subpath, '/') #you will have to play with this to get the right target folder for your app aFolder = context.restrictedTraverse(targetFolder) searchRes = aFolder.Catalog(<some search string here>) <do something with search results here>
First of all, thank you very much for your help. I'm confused. I had a programmer working for me that wrote the following code: return 0 catalog = '' try: catalog = getattr(context, context.superValues('ZCatalog')[0].id) except AttributeError: pass if catalog: return 1 Now, that works just fine if I leave the page template that calls it in the folder of a specific Web site. But when I put that template in a "root" folder that all the Web sites of the portal can call, it only gives me a printout of the tree of what's in the root folder. What I'm trying to accomplish is that it gives me the tree of the specific Web site folder from which it is called. My problem is that I frankly don't understand what my programmer wrote...how it works. Research taught me that "superValues" returns the meta_data of ZCatalog, we're popping the first element of the tuple, getting it's ID, all in context of the call, and calling that a catalog. But why do we return "1" if we get a catalog? How does that print the catalog? Then, how do I incorporate your information to achieve my goal? Thanks for any help you care to offer, Javier ____________________________________________________________________________________ Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com
I'm confused. I had a programmer working for me that wrote the following code:
return 0
catalog = ''
try:
catalog = getattr(context, context.superValues('ZCatalog')[0].id)
except AttributeError:
pass
if catalog:
return 1
There is 'return 0' at the beginning, or it is a mistake? If it is 'return 0' then the code below it is never executed... -- Maciej Wisniowski
participants (2)
-
Javier Subervi -
Maciej Wisniowski