[Zope-Moz] Templates anyone?

Shalabh Chaturvedi shalabh@pspl.co.in
Sun, 27 Feb 2000 22:11:59 +0530


From: Martijn Pieters
> From: Shalabh Chaturvedi
> > From: Martijn Pieters
> > >
> > > But you can no longer make any changes to the component source then,
> > > unless you hunt down all the DTML methods it is used in and re-parse
> > > those as well! Not very elegant I'd say.
> >
> > IMHO, I disagree.
> > Isn't what you say also the case with:
> >   o  All Zope products
> >   o  Any new tags (like calendar) that may be defined
> >   o  Any DTML Method that has a number of <dtml-var xVar> and
> >       expects all the xVars to be defined when it is called.
>
> No. I can change a product and restart the Zope server. All instances of
> the Product are then updated with the new functionality. The same goes
> for parsed dtml-tags, like the calender tag.

But it could break things unless you are careful.
What if you deleted a method of one of the classes? Or changed the name of an
instance variable?
The existing objects of classes defined by the Product could be now broken. New
objects you add may not work well with existing objects of this or other
products.

Similarly is would be possible to change the source of a 'template' taking care
not to break anything.

> I am not sure what you mean
> with the DTML Method.
> >
> > > No, the component should be any callable Zope object. That
> > > way you keep
> > > it OO and reusable.
> >
> > It is reusable, once it is defined. OO and Patterns are not
> > enemies. They mix
> > well, in fact.
> >
> > Having a single component_contents doesn't provide anything
> > new. Doing what it
> > does has always been possible: the template/component might
> > just as well be a
> > DTMLMethod called myTemplate and used as:
> >
> > <dtml-let componentContents=" foo ">
> >    <dtml-var myTemplate>
> > </dtml-let>
> >
> > Instead if we have two levels of evaluation, we get more
> > reusability, not less.
>
> Who said it was new technology? It is a new paradigm, one we could work
> on still. But I don't think we should add a new syntax and a limitation
> to one way of creating a component OO would let you use different
> classes of objects for the component tag, your special syntax proposal
> would not.

I didn't understand the the component tag then.

I did mean my tag to be used for only one kind of object - which wouldn't be
just_another_zope_object but a special one. You wouldn't include the object
with a dtml-var or something. Like acl_users. (Although now I'm thinking if
something otherwise would be possible).
But my tag can achive a lot more than what a component tag can. It isn't the
syntax I want to think about yet but a new paradigm.

I also now sort of see what your point is. I was thinking the component tag is
meant to solve a problem it is not.

And so now I don't want to position my idea as 'a better dtml-component' but as
something entirely new. Something (I feel) would be a great addition to core
Zope and would benifit ZopeStudio too. I also won't call it a template but a
'pattern' to avoid confusion.

I'll make a post to zope-dev, I think.

Any comments on a new 'reusable pattern' paradigm?

Shalabh