[Zope] Dicts in folder attributes

Shaw, Howard ShawH@STHS.org
Sun, 14 Feb 1999 17:58:04 -0600


Paul told me how to extract a list of column names from a returned SQL
result. Now I need my DTML document to have ready access to a dict
mapping the potential names to human-readable names, so that whichever
columns show up in my result, the DTML knows how to display it.

Basically where my table could contain column names like 'DOB' I want to
display 'Date of Birth', but without actually knowing whether 'DOB' is
present in the output prior to rendering the page. 

Therefore I want to make a dict like {'DOB':'Date of
Birth','SSN':'Social Security Number',...}. But since this is not really
data that is solely relevant to that single DTML document, I would
rather not have to specify it by an ugly <!--#with
"_.namespace(trans_table={'DOB'...}-->. 

Is making an External Method class and assigning the results to map to
that class my only option? I would prefer a folder attribute, because an
External Method requires me to go back to the filesystem to change it;
but folder attributes don't seem to have dict as an option. 

Any ideas would be appreciated. [Note: this would be much easier if
there was a non-containing version of 'with'. Something that edited the
actual namespace, instead of making an altered namespace available to
its contents. It would be much easier to pull in sets of variable
references from other DTML documents.]