[Zope3-dev] Absolute URLs and Named vs. Unnamed Adapters

Bjorn Tillenius bjoti777 at student.liu.se
Thu Apr 21 13:33:47 EDT 2005


On Thu, Apr 21, 2005 at 01:00:16PM -0400, Brad Bollenbach wrote:
> On Wed, Apr 20, 2005 at 12:12:04PM -0400, Bjorn Tillenius wrote:
> > On Fri, Apr 15, 2005 at 03:26:41PM -0400, Brad Bollenbach wrote:
> > 
> > [snip explanation about having register the same component twice when
> >  adding a new absolute url view]
> 
> [more snipping about why this is the case]
> 
> > IMO, the problem lies in that we can't look up a view providing a
> > specific interface. I don't think that zapi.absoluteURL should be
> > changed to solve problems related to ZPT. Instead it would be better to
> > make the ZPT adapter look up a view providing IAbsoluteURL, and use
> > that to do its work. That way when defining a new IAbsoluteURL view,
> > we'd only have to register an unnamed view, and it'd be used both in
> > Python code and in ZPT.
> > 
> > Any objections against implementing this solution?
> 
> Can you give an example of what your idea for an implementation would
> look like to me using this in ZPT?

First, ff it wasn't clear, I was suggesting that I would add this to
Zope3.

So, today you use <a tal:attributes="href foo/@@absolute_url">

With my solution, if you would want to change the way the absolute URL
is generated for foo, you would register an unnamed view providing
IAbsoluteURL for foo.

After that when you use the above line, your IAbsoluteURL view will be
used instead. Nothing would be changed, just instead of having to
register two views, when named and one unnamed, you'd only have to
register one unnamed.

So nothing would change for you, apart from not having to register two
views.

Regards,

Bjorn


More information about the Zope3-dev mailing list