[Zope] inconsistency in tag argument syntax

Jay, Dylan djay@lucent.com
Fri, 8 Oct 1999 09:04:56 +1000


> -----Original Message-----
> From: Michael Bernstein [mailto:mbernstein@profitscape.net]
> Sent: Friday, October 08, 1999 02:52
> To: Jay, Dylan
> Subject: Re: [Zope] inconsistency in tag argument syntax
> 
> 
> "Jay, Dylan" wrote:
> 
> > After playing around with making a tag an inconsistency in 
> the tag syntax
> > became apparent to me. Sometimes "asd" is treated as an  
> expression and
> > sometimes as a string. e.g.
> > <dtml-let blah="aObject.method()"> is an expression however
> > <dtml-mime name="aObject.method()"> makes the name argument 
> a string with
> > 'aObject.method()'
> > This is confusing and inconsistent. Also treating any 
> argument always as a
> > string means that the value of the argument can never be dynamically
> > specified i.e. there is no way I could name a mime block 
> dynamically e.g.
> > from a form. The same applies for instance to the 'sort' argument in
> > <dtml-in>. This is very limiting.
> >
> > The problem is however that I can't see a backwards 
> compatible way of fixing
> > this problem. Alternatives are
> > a) You could introduce a evaluate expression syntax like 
> there is in sh
> > script. i.e. name="`myMethod()`". This however makes things 
> more confusing
> > and unreadable.
> > b) Another possibility is to make all "non-expression" 
> arguments become
> > expression arguments. This would break existing code and 
> mean all string
> > constants look like name="'A name'" which is also not 
> intuitive and messy.
> > This could be made cleaner by allowing syntax such as name='A name'.
> > c) Or ignore the problem.
> >
> > I prefer option b).
> > What do other people think?
> 
> If you want to provide dynamic atributes for all tags, the 
> "&dtml-foo" entity
> syntax would be more appropriate, and would avoid breaking current
> implementations (I think). You would just have to assign the 
> value of your
> expression to foo beforehand.

Are you saying that 
<dtml-let orderby="'aFieldName'">
<dtml-in aList sort=&dtml-orderby>
</dtml-in>
</dtml-let>

will work? I don't think this is the case. From looking at the code I saw no
place where this happens.