[z3-five] Can't call absolute_url on a z3 view in z2.10
Philipp von Weitershausen
philipp at weitershausen.de
Tue Jun 26 01:03:46 CEST 2007
On 25 Jun 2007, at 16:45 , whit wrote:
> Philipp von Weitershausen wrote:
>> whit wrote:
>>> view/@@absolute_url would be asking for a view on a view. I
>>> don't *think* this would even work for generic views in straight z3.
>>
>> Sure it does. A view is just any other object in the object
>> hierarchy (it happens to be found differnetly than persistent
>> objects, but that's a detail).
>>
>>
> unlike the zope2 publisher, I haven't pdbed through the zope3
> publisher a thousand time, so I haven't seen exactly *why* this
> works. Is absolute_url a view on a view in zope3?
absolute_url is a view on *, which means *any* object and that
includes views.
Also, resolving a TALES expression like obj/@@some_view/
@@absolute_url has nothing to do with the publisher. Because you're
not publishing a URL. You're just resolving a path that maybe looks a
bit like a relative url, but it's just a path in your object graph.
(Try going to http://localhost:8080/@@absolute_url in Zope 3. It
won't work, and that's the way it should be, unlike in Zope 2).
Note that Zope 3's absolute_url view, much like Five's absolute_url
view, is lying a bit. It really expects a __parent__ attribute for
walking up the hierarchy to compute the URL (browser views have
__parent__, that's why it works), so it should really be registered
for ILocation (which is the API that guarantees __parent__).
Likewise, Five's absolute_url view expects an aq_parent, so it should
really be registered for one of those interfaces from
Acquisition.interfaces.
More information about the z3-five
mailing list