Dicts in folder attributes
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.]
I think you'll find that TinyTable (from the contrib area of the zope site) will do what you want. Anthony
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.]
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
On Mon, 15 Feb 1999, Anthony Baxter wrote: or even the XMLConfig product if you wish to have the dictionary mapped onto an external file. Pavlos
I think you'll find that TinyTable (from the contrib area of the zope site) will do what you want.
Anthony
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.]
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
participants (3)
-
Anthony Baxter -
Pavlos Christoforou -
Shaw, Howard