[Zope-CMF] Re: Moving to browser views

Maurits van Rees m.van.rees at zestsoftware.nl
Wed Jul 18 17:10:27 EDT 2007


Charlie Clark, on 2007-07-18:
> Okay, thanks! I'm nearly there. I think. %-? ;-)
>
> Because I'm only creating essentially a slightly different view of an  
> event I've taken the ZCML for the standard view as a lead:
>
>    <browser:page
>        for="Products.CMFCalendar.interfaces.IEvent"
>        layer="Products.CMFDefault.interfaces.ICMFDefaultSkin"
>        name="event_iCal_view"
>        class=".event.EventiCalView"
>        permission="zope2.View"
>        />
>
> is event_iCal_view my view class?

No, that is the name.  That means you can do

  tal:define="view context/@@event_iCal_view"

in a template that has an IEvent provider as context.

The class is the EventiCalView class in event.py.


> So, let's say I need to turn my creation date into
> 20030127T090000Z
>
> I can call this in my view class via
> self.startdate = self.context.CreationDate()
>
> and call this in my template via
>
> view/startdate?

Yes.  You need to do the tal:define above first though, unless there
is some other magic (well, code) that hooks up this view to that
specific template.  I think that is done when you specify
template="mytemplate" in the zcml snippet.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
            Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."



More information about the Zope-CMF mailing list