|
Re: zope.viewlet and zope.contentprovider - options for Zope 2 and Plone 3: msg#00055web.zope.z3base.five
On Sun, 09 Apr 2006 21:25:39 +0100, Martin Aspeli wrote: > Now, I have a feeling that this could be faked in Zope 2 with something > like: > > <tal:block replace="structure python:provider('provider.name')" /> > > the object 'provider' would have to be defined globally (in > global_defines.pt in Plone). Its implementation would basically be > identical to the TALESProviderExpression in zope.contentprovider, with a > __call__() method that called update() and render() on an IContentProvider > looked up by the name it was passed. > > The tricky part is the ITALNamespaceData update magic that needs to read > the TAL context: > > - Is there some way a python object referred in an expression like the > one above could be passed or acquire (literally or figuratively) TAL > objects defined in the current context at that point? Precisely because I wanted to "emulate" something like viewlets, I have a ready solution to do this kind of reentrance in Zope2, see http://www.zope.org/Members/ree/zptcontext . It's a big time hack for more reasons, mostly because the pagetemplate code is not designed re-entrant. It works pretty stable, though, in practice. The usage is get the econtext from python via get_econtext, and then call the page template in a reentrant way via pt_render_in_econtext. You can also think about this as a way to substitute macros. However having the real viewlets that work in Plone would be a greater deal. Also the closer we get to Zope3 the more things we can reuse instead of duplicating them, so that's a very strong reason for switching to the Z3 template rendering engine asap. -- Balazs Ree jabber + email: ree-DIAULbSzolw@xxxxxxxxxxxxxxxx ICQ: 75955071 AIM + skype: reebalazs ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: zope.viewlet and zope.contentprovider - options for Zope 2 and Plone 3: 00055, Tres Seaver |
|---|---|
| Next by Date: | Re: zope.viewlet and zope.contentprovider - options for Zope 2 and Plone 3: 00055, Stephan Richter |
| Previous by Thread: | Re: zope.viewlet and zope.contentprovider - options for Zope 2 and Plone 3i: 00055, Tres Seaver |
| Next by Thread: | Re: zope.viewlet and zope.contentprovider - options for Zope 2 and Plone 3: 00055, Stephan Richter |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |