[Zope3-Users] Acess view class method of foreign object
Dominik Huber
dominik.huber at projekt01.ch
Tue Feb 22 13:00:49 EST 2005
Florian Lindner wrote:
>Am Dienstag, 22. Februar 2005 13:28 schrieb Dominik Huber:
>
>
>>Florian Lindner wrote:
>>
>>
>>>Hello,
>>>I iterate though all items of a folderish object in its view:
>>>
>>><div tal:repeat="item context/values">
>>>Desc: <span tal:replace="item/view/getShortDescription">Desc</span><br />
>>></div>
>>>
>>>The above sippet does not work.
>>>
>>>getShortDescription is a object of the view class of the contained object
>>>type. In views of this object it would be accessed with
>>>view/getShortDescription. How can I access it from another view?
>>>
>>>
>> item/@@subview/getShortDescription
>>
>>where subview ist the name registered within ZCML.
>>
>>for example:
>>item/@@absolute_url/breadcrumbs
>>
>>
>
>Sorry, I meant
>
>
>
>>>getShortDescription is a _method_ of the view class of the contained object
>>>
>>>
>
>Mmmh, I tried tal:replace="item/@@link.html/getShortDescription"
>
>but it does not work.
>
>The view is registered with:
>
> <page
> name="link.html"
> for="CS.Linklist.interfaces.ILink"
> class=".link.Link"
> template="link.pt"
> permission="zope.View"
> layer="centershock"
> />
>
>getShortDescription is a method of .link.Link.
>
>And I want to access the method from a view on ILinklist.
>
>
you have to declare an *allowed_interface* or an *allowed_attribute*
attribute inside the page directive, too.
look at the absolute for example:
<browser:page
for="*"
name="absolute_url"
class=".AbsoluteURL"
permission="zope.Public"
allowed_interface=".interfaces.IAbsoluteURL"
/>
\src\zope\app\traversing\browser\configure.zcml
\src\zope\app\traversing\browser\interfaces.py
\src\zope\app\traversing\browser\absoluteurl.py
regards,
Dominik Huber
More information about the Zope3-users
mailing list