[Zope] creating link to parent container.

Nicolas Évrard nicoe@altern.org
Wed, 21 May 2003 14:15:05 +0200


* John Kipling Lewis  [13:41 21/05/03 CEST]: 
>On Wed, 21 May 2003, [iso-8859-1] Nicolas Évrard wrote:
>
>> is a link to the container of the page template. If this page template
>> is acquired as in :
>>
>> http://.../site/animals/dog/waf/showPhoto with showPhoto a pt residing
>> in animals, this link will point to http://.../site/animals.
>>
>> If you want to point to http://.../waf you should use
>> 'here/absolute_url'.
>
>I see the mistake I'm making now, we were looking at the index_html so m=
y
>URL looked like:
>
>http://.../site/animals/dog/waf/
>
>When I asked for "here/absolute_url" I got the same result.
>
>If I'm in "http://.../site/animals/dog/waf/", how do I return:
>
>http://.../site/animals/dog/

Well this is a quick hack (I didn't test it) :

In a pythonScript (parameter origin) :

url = origin.split('/')[:-1]
return '/'.join(url)

and in your zpt :

<a href="#" tal:attributes="href python:upscript(here.absolute_url())">

-- 
(°>  Nicolas Évrard
/ )  Liège - Belgique
^^