[Zope] Q: Namespace, Acquisition, and Properties

2000-06-05 Thread Wilkinson Charlie E
Title: Clear Day



Greetings,
I've dug around, but not found (or not grokked) the solution to 
thisparticular puzzle. Could someone more knowledgeable provide a 
littleenlightenment?

In the top level folder (root) I have a dtml method title templatethat 
contains html code and dtml vars that are (intended to be)populated by 
properties of various subfolders as well as a value ortwo passed 
directly. The title template is "called" from dtmlmethods 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 
dtmlmethods. (Thanks to acquistion, yes?)

However, I get Zope KeyErrors indicating that the title template isnot 
seeing the sub-folder properties in its namespace, when I plugthe above code 
into a dtml method contained in one of those sub-folders. Here's the 
title_block code:

CENTERtable border=1dtml-if 
"_.has_key('titleblock_bg')" bgcolor="dtml-var 
titleblock_bg"dtml-else 
bgcolor="#55"/dtml-ifTRTD 
align=center FONT 
size=7dtml-if "_.has_key('title_fg')" color="dtml-var 
title_fg"dtml-else 
color="#009900"/dtml-ifdtml-var 
app_title/FONTBR 
FONT size=4dtml-if "_.has_key('subt_fg')" 
color="dtml-var subt_fg"dtml-else 
color="#009900"/dtml-ifdtml-var 
app_subt/FONTHR 
FONT size=5dtml-if "_.has_key('screen_fg')" 
color="dtml-var screen_fg"dtml-else 
color="#009900"/dtml-ifdtml-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 
likeapp_screen may be passed explicitly as literals. The rest 
(likeapp_title) was intended to be grabbed from the 
folder/sub-folderproperties I set up for that purpose.

So, two questions:

1. Is there a simple way to pass the appropriate sub-folderproperties 
namespace from a dtml method contained in that sub-folderto the title_block 
dtml method contained in the root folder? Anexample 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:TDPhone: 202-283-3241 MSMail: Charlie E 
Wilkinson SMTP: [EMAIL PROTECTED] Home: [EMAIL PROTECTED] This message constructed from 90% post-consumer 
electrons. 



Re: [Zope] Q: Namespace, Acquisition, and Properties

2000-06-05 Thread Christopher J. Kucera

 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

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )