On 8/14/06, Stephan Richter <[EMAIL PROTECTED]> wrote:
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?
A Page class (or any provider manager) may optionally list names. The names also provide some ordering support (ensuring that provider A is updated before provider B). If no names are listed in the class, then all Content Providers registered for the page are looked up:: self._content_providers = dict(zapi.getAdapters( (self.context, self.request, self), IContentProvider ))
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.
I wouldn't want to be bound to TAL though. As I mentioned, we use a STAN-inspired system for generating HTML in many places where there's no desire to maintain a separate file just to render something simple - or even moderately complex. As we've also started implementing a system inspired by Rails Helpers which eases some generation of common tasks from formatting to link/URL generation, our need to TAL has decreased. It's still useful in design heavy sites, but I'm really starting to wish for some simplified expressions (even TALES expressions would be nice) to do structured inserts with a helluva-lot-less typing. We still use page templates fairly heavily. I just wouldn't want to depend on TAL code so heavily that any other template/html/xml generation system one wants to plug in really becomes a second or third class citizen at that point.
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.
We haven't gone into super-heavy usage, but that should start changing this week as we push for the front end UI of this project. Then we'll see if my theories worked :).
BTW, another part of the UI power tools is zc.table. I will publish a bunch of extensions later this week.