Hi Tim, On 6/1/07, Tim Hicks <[EMAIL PROTECTED]> wrote:
Yes and know, if I understand things correctly. I am already using custom traversal in order to allow URLs like "http://example.com/weblog/2007/06/01/blog_post" to work (Although the code that does this is a bit dated, and doesn't used IPublishTraverse, I think <http://dev.plone.org/collective/browser/Quills/branches/maurits-traversal/traversal.py?rev=42943>.)
Ah, right.
What I'm trying to do now is make it so that methods on my weblog object will return lists of IWeblogEntry-ish objects that know what sort of URL they should have. That way, I can call IWeblog.getLazyEntries(), which does a catalog search for appropriate IWeblogEntry objects, and then call absolute_url (or getURL) on each of the returned objects and have it return a blog-archive-ish URL rather than where it really lives. If I understand correctly, this latter case has nothing to do with IPublishTraverse,
True.
hence my desire to wrap/proxy the brains/objects with something that will give my the correct URL behaviour, and then just pass everything else through to the underlying object. My attempt at implementing this is at <http://dev.plone.org/collective/browser/Quills/branches/maurits-traversal/traversalfaker.py?rev=42942>.
That file name should alert you that you're doing something wrong. :)
Does this approach make sense? If so, how can I get restrictedTraverse to call my proxy's absolute_url method rather than the underlying one? (At least, I think it's restrictedTraverse that's not doing what I want...)
I really wouldn't go down this route. :) Trying to make transparent proxies that messes with traversal is a thing best left to those willing to risk losing most of their hair. It's not clear to me what restrictedTraverse() has to do with this, and where it's being called from. However, I would move the level of abstraction up one step, and think about what *uses* getLazyEntries(). Instead of returning raw catalog brains, this could return dicts, and calculate the URL from catalog metadata. Alternatively, you could have another piece of metadata in the catalog which stores the URL, e.g. just indexing a method which calculates it. Martin _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
