[Zope] inconsistency in tag argument syntax
Michael Bernstein
mbernstein@profitscape.net
Fri, 08 Oct 1999 11:59:24 -0700
"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.
HTH,
Michael Bernstein.