[Zope] Strings, Names and dtml-var

swallace@trilobyte.net swallace@trilobyte.net
Sat, 21 Oct 2000 11:38:49 -0700


Ok, Being fairly new at Zope, I am really confused, I think I have 
looked through all the FAQs, How to's, examples, and what ever, but 
I still can not get the right combination to get this to work (many 
combinations tried :-)...). The basic intent is to easily change a 
property "color_source" in a directory that will cause the "color1" 
property to be looked up from a different directory. The directory 
name "default" could be one of many that holds different color 
themes. Thanks in advance.
***************************Code
This does not work: get_color method
<dtml-let myname="'Colors.'+color_source+'.color1'">
   <dtml-var expr="_[myname]">
</dtml-let>
This works:
<dtml-var "Colors.default.color1"> which renders #FFFFFF
***************************Key
get_color = a method, /Business/Base/get_color
color_selection = a property in the current directory containing 
the string "default" without quotes
Colors = a folder, /Business/Colors
default = a folder, /Business/Colors/default
color1 = is a property under default containing the string 
"#FFFFFF" without quotes
Zope = 2.2.2
OS = Win98
***************************Error Message
Error Type: KeyError
Error Value: Colors.default.color1

Troubleshooting Suggestions
This resource may be trying to reference a nonexistent object 
or variable Colors.default.color1. 
The URL may be incorrect. 
The parameters passed to this resource may be incorrect. 
A resource that this resource relies on may be encountering 
an error.