On Monday 14 August 2006 01:00, Jeff Shell wrote: > I (mildly) agree. In my `WebPageSupport` mix-in, I've added a method > `renderProvider`. Primarily it was to get around calling the provider > a second time and having its `update` method called again, although > I've now added some a `hasUpdated` concept to our ContentProvider base > classes. But these are what I've added to our class. Again > `WebPageSupport` is a mix-in (so it can be used with some basice > BrowserView based base classes, as well as some `formlib` base/edit > form based classes) that turns a web page into a ContentProvider > Manager, ensuring that providers that are mentioned in the standard > template(s) as well as ones specifically referenced by a Page are all > updated at the same time:: > > def updateProviders(self): > for provider in self.contentProviders(): > provider.update() > > def renderProvider(self, name): > provider = self.get(name) > if provider is None: > return u"" > return provider.render() > > `updateProviders` is typically called in the `update` phase of the > view/page, and `renderProvider` is typically called in the page > template or other code (like our nevow.Stan / Seaside inspired > system). This behavior is just a little bit more predictable than > `provider:`, is usable outside of TAL/TALES, and jumps straight to > `render` since it's typically being called in the rendering phase of > the surrounding view anyways.
Right, so you fixed the problem with the provider TALES expression, which has to do update()/render() at the same time. My question is: How do you know which content providers are used by a view? Do you manually list them? I was thinking about implementing a way to inspect TAL code to determine all the providers that should be looked up before rendering. I even talked to Fred about it already; but it is non-trivial, if I understand him correctly. > (although, we still use `provider:` quite a bit for most of the core > viewlet managers that are used in the main template that have become > practically invisible to us, such as the ones that load up all of the > head resources). Right, I see you use viewlets/providers heavily; at least we are not the only ones. :-) I would be interested in a lot more dialog here to share best practices and code. BTW, another part of the UI power tools is zc.table. I will publish a bunch of extensions later this week. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training _______________________________________________ Zope3-users mailing list Zope3firstname.lastname@example.org http://mail.zope.org/mailman/listinfo/zope3-users