[Zope] Newbie question

Malcolm Tredinnick malcolm@commsecure.com.au
Sat, 22 Apr 2000 16:47:58 +1000


On Fri, Apr 21, 2000 at 11:33:16PM -0700, gpgreen@olywa.net wrote:
> On Sat, Apr 22, 2000 at 04:04:58PM +1000, Malcolm Tredinnick wrote:
> > The syntax you want, if I've understoof the question, is (untested):
> > 	<dtml-var "the_other_dtml_method(_['sequence-item'])">
> > 
> > You need to do it this way because the stuff inside the quotes is a python
> > expression and hyphens are not permitted in Python variable names. So you use
> > the magical _ namespace, which contains things like sequence-item as a key.
> 
> Very nice. Now how do I reference the variable in the_other_dtml_method? I 
> assume it is in the other methods namespace, but what name does it have?

Doh! Please pay no attention to me ... I completely misread your question :-(
I read the bit inside quotes as "Python_external_method". Bad me! No cookie!

Onto the real answer: 
 
My understanding is that the namespaces are inherited for dtml-methods, so if
you replace my gibberish above with

	<dtml-var the_other_dtml_method>

you should still be able to talk about sequence-item. In a recent Zope site I
have been working on, I did a lot of things that were exactly like this. The
only difference was that because, in my case, sequence-item was a tuple, I
would have things like this:

	<dtml-with "my_method_that_returns_a_list_of_tuples()">
		<dtml-let name="_['sequence-item'][0]"
		          title="_['sequence-item'][1]">
		<dtml-var display_data>
		</dtml-let>
	</dtml-with>

In this example, display_data was a dtml-method that put the 'name' and
'title' things in a table and it just referred to them as <dtml-var name> and
<dtml-var title>. So talking about <dtml-var sequence-item> should be the
same.

My sincere apologies for the entirely misleading answer earlier.

Cheers,
Malcolm

-- 
Malcolm Tredinnick			 email: malcolm@commsecure.com.au
CommSecure Pty Ltd