[Zope3-Users] Replacing Macros with Contentprovider

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Sep 9 12:30:50 EDT 2006

On Friday 08 September 2006 19:19, ksmith93940-dev at yahoo.com wrote:
> Thanks for your reply. So, when you say macros still
> excel for general O-wrap, do you mean things like
> style_slot, script_slot and body_slot or do you also
> include  things like header_slot, navigation_slot,
> breadcrumb_slot and footer_slot as well?

We only use the body slot. Style, scrpting, header, navigation, breadcrumb and 
footer are all content providers.

Basically, we use the main template to organize the set of all content 
providers. But as I am writing this I am chatting with Juergen Kartnaller 
that our new project will be 100% content providers/viewlet 
managers/viewlets. Since I am not working on this myself, I have no clue 
about the details, but I am going to see Juergen next week, so ping me or him 
then again. :-)

> I'm a little confused as to whether render() from
> contentprovider must only provide a string or if a zpt
> can be used?

All that the render() method is required to do is to return a string. How this 
string is created is up to the implementation. Of course, we are often using 
templates of the form:

class ContentProvider(...):

    template = ViewPageTemplateFile('template.pt')

    def render(self):
        return self.template()

> If a zpt can be used, does the namepace "view" access
> the contentprovider object or the __parent__ view
> object? Is  the namespace "context" available as the
> original object?

Yep, yep.

view -> is the ContentProvider instance as seen above.
context -> is the regular context that is also the context of the view
__parent__ -> The view object

Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training

More information about the Zope3-users mailing list