Q: Namespace, Acquisition, and Properties
Greetings, I've dug around, but not found (or not grokked) the solution to this particular puzzle. Could someone more knowledgeable provide a little enlightenment? In the top level folder (root) I have a dtml method title template that contains html code and dtml vars that are (intended to be) populated by properties of various subfolders as well as a value or two passed directly. The title template is "called" from dtml methods in the root and sub-folders using something like: <dtml-var "title_block(app_screen = 'Main Screen')"> I have no problem getting at the title template from any of the dtml methods. (Thanks to acquistion, yes?) However, I get Zope KeyErrors indicating that the title template is not seeing the sub-folder properties in its namespace, when I plug the above code into a dtml method contained in one of those sub- folders. Here's the title_block code: <CENTER> <table border=1 <dtml-if "_.has_key('titleblock_bg')"> bgcolor="<dtml-var titleblock_bg>" <dtml-else> bgcolor="#111155" </dtml-if>
<TR><TD align=center> <FONT size=7 <dtml-if "_.has_key('title_fg')"> color="<dtml-var title_fg>" <dtml-else> color="#009900" </dtml-if>
<dtml-var app_title></FONT><BR> <FONT size=4 <dtml-if "_.has_key('subt_fg')"> color="<dtml-var subt_fg>" <dtml-else> color="#009900" </dtml-if> <dtml-var app_subt></FONT><HR> <FONT size=5 <dtml-if "_.has_key('screen_fg')"> color="<dtml-var screen_fg>" <dtml-else> color="#009900" </dtml-if> <dtml-var app_screen></FONT> </TD></TR> </TABLE> </CENTER>
(Ok, try not to laugh too hard - I'm Zope newbie...) Some values above are optional (the has_key stuff). Values like app_screen may be passed explicitly as literals. The rest (like app_title) was intended to be grabbed from the folder/sub-folder properties I set up for that purpose. So, two questions: 1. Is there a simple way to pass the appropriate sub-folder properties namespace from a dtml method contained in that sub-folder to the title_block dtml method contained in the root folder? An example would be tremendously helpful. 2. Is there a better way to do what I'm trying to do? Thanks for any help, Charlie -- Charlie Wilkinson - TRIS Development Systems Administrator IS:SD:CT:CC:TD Phone: 202-283-3241 MSMail: <mailto:Charlie E Wilkinson> Charlie E Wilkinson SMTP: <mailto:cwilkins@tris.irs.gov> cwilkins@tris.irs.gov Home: <outbind://7/cwilkins@boinklabs.com> cwilkins@boinklabs.com This message constructed from 90% post-consumer electrons.
Wilkinson Charlie E wrote: In the top level folder (root) I have a dtml method title template that contains html code and dtml vars that are (intended to be) populated by properties of various subfolders as well as a value or two passed directly. The title template is "called" from dtml methods in the root and sub-folders using something like:
<dtml-var "title_block(app_screen = 'Main Screen')">
Chances are, you're losing your namespace. When you call another method in quotes, you tend to lose a lot of information unless you use the cryptic: <dtml-var "title_block(_.None, _, app_screen='Main Screen')"> or: <dtml-var "title_block(REQUEST,_,_.None, app_screen='Main Screen')"> I'm guessing this'll fix it for you. :) Good luck! (Oh, and try not to post HTML to the list . . .) -CJ
participants (2)
-
Christopher J. Kucera -
Wilkinson Charlie E