Hi, I'm currently developing a product using the plone.app.dexterity content types, in which I have two schemas, say IMyFolder and IMyItem, which give rise to content types via dexterity. Furthermore, I am implementing a portlet, say MyPortlet.
I would like to achieve the following: If MyPortlet is added to any folder, it should traverse the containment hierarchy until it finds an IMyFolder. Then it should display the IMyItems contained inside this IMyFolder. I have thought about different ways, but I am not sure, which is the proper or correct way to do this: 1) Implement a view "@@myitems" without a template on IMyFolder, which uses a catalog search to return the IMyItems contained in it. The MyPortlet applies @@myitems on the current context and relies on acquisition so that it bubbles up until an IMyFolder is found. 2) Define a custom class for IMyFolder based on the dexterity folder class. Add a method "myitems" that returns the contained IMyItems. The MyPortlet then tries to call this method on the current context and relies again on acquisition. 3) Define an adapter from the IMyFolder interface to a new interface, say IHasMyItems, which has a method called "myitems". The MyPortlet then calls aq_chain and traverses the acquisition chain by hand until it has found an object which can be adaptet to a IHasMyItems. Hopefully, I have been clear enough so that you understand what I want to say. :-) Thanks, Marc -- View this message in context: http://plone.293351.n2.nabble.com/What-s-the-proper-way-to-add-methods-to-dexterity-types-tp4992210p4992210.html Sent from the Product Developers mailing list archive at Nabble.com. _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
