[Zope] The XML-dtml notation "&dtml-variable;"

Johan Carlsson johanc@torped.se
Thu, 4 Nov 1999 20:39:02 +0100


>
> Would something like this be more palatable?
>
>     <dtml-var foo default="Empty">

It would definitely be a start.

This is the scenario I been working with today that got me thinking:
(thinking because it's allot of work for do simple stuff, and I'm lacy ;)

I prefer the &dtml-Var; tag for the XML validity.
Isn't the &dtml-Var; is equal to the <dtml-var Var> by the way? (I have just
glanced trough the source)

I am working on a mail form where I what to use the same
template as the initial mail-form and as the "you need to fill out
these fields correctly"-error mail-form.

It looks like this:

<form ...>
...
<input ... name="email" value="&dtml-email;">
...
</form>


Not this breaks when used as the initial mail-form.

Now I considering the solutions:

1. Using try to ignore exceptions:

  <dtml-try> ...
    <input ... name="email" value="&dtml-email;">
    ...
    <input ... name="name" value="&dtml-name;">
    ...
    <input ... name="adress" value="&dtml-adress;">
  <dtml-except NameError, Key not found(or what ever exception)>
    <dtml-do-next > # And this returns to execute the next dtml-statement
after the exception
  </dtml-try>


2. The default value version (described in earlier mail):
   (a)
      <dtml-with "dtml-var-default='empty string'">
        ... <input ... name="email" value="&dtml-email default='';"> ...
      </dtml-with>

    (b)

        ...  <input ... name="email" value="&dtml-email default='';">  ...

      # (is this valid XML by the way, with a space in the "&...;"?
      #  not considering the lack of "</input>")


Are you reading what I'm getting at?
DTML has allot of akwardties that really scares
away people, specially newbees and people with less
talent in advanced programming (e.g.. ASP programmer's and
HTML/JavaScript coders  ;-)

//johan