[Zope] Is Zope syntax inconsistent ?
Michel Pelletier
michel@digicool.com
Fri, 10 Mar 2000 13:01:09 -0800
Glyph Lefkowitz wrote:
>
> On Fri, 10 Mar 2000, Phil Harris wrote:
>
> > As someone earlier today on the list said, "if it's in quotes it's python"
> > (or something similar).
> >
> > Basically Python rules apply when using any expressions in zope dtml-var and
> > other tags.
>
> I still think it's an inconsistent syntax. It should be possible (by
> overriding __coerce__, I think? I haven't had time to look this up yet)
> to make the == operator do something different. AUTHENTICATED_USER is
> often used as a string (at least what I've seen of it ...)
It's never used as a string because it is not a string. You can't use
the word 'string' unless you are talking about python expressions. DTML
does not have types, you must rely on python's expression machinery to
get down to thinking about the types of objects.
> Also, "if it's in quotes it's in python", why do I need to do _.str()?
> why does dir() not work? It seems like some pretty horribly munged sort
> of python...
This is for security reasons. We've overridden many of the built-in
functions like str and dir with our own so that DTML programmers cannot
do mean and nasty things, intentionally or unintentionally, from DTML.
-Michel