Re: [Zope] How to Pass values to a DTML method ??

2000-09-13 Thread Dieter Maurer

Evan Simpson writes:
   extended-attribute syntax
  (foo-name-name="x" instead of foo="_[_[x]]").
HELP!
I am sure, that such an extended attribute syntax would cause
hundreds of messages in this list.

I hope, it will not get adopted.

  I have considered proposing that we graft dtml-let's capabilities onto the
  other tags, so that we could write stuff like:
  
  dtml-var set-foo="getFoo()" var=foo set-param1=" 'text' " set-param2="id"
That is better.

Only: What does the "var=foo" mean? The thing that should be rendered?
  Then (with respect to this), the current syntax is clearer.

Or: Should this be equivalent to:
   dtml-var "getFoo(_.None,_,param1='text', param2=id)?
   Then, it is not at all obvious. "getFoo" seams to be called
   explicitly without parameters.
   Clearer would be:
   dtml-var getFoo set-param1="'text'" set-param2="id"



Dieter

___
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 )




Re: [Zope] How to Pass values to a DTML method ??

2000-09-12 Thread Evan Simpson

 Dieter Maurer
 You should include two positional parameters as well:

 dtml-var "some_method(_.None,_,param=value)"

I've recently had explained to me a way that is more robust, and possibly
less confusing, than this idiotic idiom.  I think it may start appearing in
docs and training.

dtml-let param="value"dtml-var some_method/dtml-let

...or even better...

dtml-let param="value"dtml.-some_method;/dtml-let

...which allows nicely for stuff like:

dtml-let foo="sequence-item" bar="foo.objectIds()" firstbar="bar[0]"
a href="dtml-firstbar;"First!/a
/dtml-let

Cheers,

Evan @ digicool  4-am


___
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 )




Re: [Zope] How to Pass values to a DTML method ??

2000-09-12 Thread Daniel Rusch

They pass in the current name space, the context if you will. Someone
posted a reply that had a link to the faq that attempts to explains
this.

DR
Stuart Foster wrote:
 
 This is the way I had to do it what's up with the two extra params?
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
 Dieter Maurer
 Sent: Monday, September 11, 2000 2:24 PM
 To: Stuart Foster
 Cc: Zope List
 Subject: Re: [Zope] How to Pass values to a DTML method ??
 
 Stuart Foster writes:
   I have a DTML method that is called from a document. I need to pass a
 value
   to it like a parameter would be passed to a function.
  
   dtml-var some_method(param=value)
 That does not look too bad, but you forgot the "..." around the call.
 
 You should include two positional parameters as well:
 
 dtml-var "some_method(_.None,_,param=value)"
 
 Otherwise, you cut the namespace propagation.
 
 Dieter
 
 ___
 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 )
 
 ___
 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 )

___
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 )




RE: [Zope] How to Pass values to a DTML method ??

2000-09-12 Thread Stuart Foster

The first example is what I was doing. But felt it was hard to follow.
However I would be interested in why it would be considered more robust.

-Original Message-
From: Evan Simpson [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 11, 2000 8:15 PM
To: Stuart Foster; Dieter Maurer
Cc: Zope List
Subject: Re: [Zope] How to Pass values to a DTML method ??


 Dieter Maurer
 You should include two positional parameters as well:

 dtml-var "some_method(_.None,_,param=value)"

I've recently had explained to me a way that is more robust, and possibly
less confusing, than this idiotic idiom.  I think it may start appearing in
docs and training.

dtml-let param="value"dtml-var some_method/dtml-let

...or even better...

dtml-let param="value"dtml.-some_method;/dtml-let

...which allows nicely for stuff like:

dtml-let foo="sequence-item" bar="foo.objectIds()" firstbar="bar[0]"
a href="dtml-firstbar;"First!/a
/dtml-let

Cheers,

Evan @ digicool  4-am


___
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 )




Re: [Zope] How to Pass values to a DTML method ??

2000-09-12 Thread Evan Simpson

From: Stuart Foster [EMAIL PROTECTED]
 The first example is what I was doing. But felt it was hard to follow.
 However I would be interested in why it would be considered more robust.

I probably misused the word; what I meant was that the dtml-let form is
less likely to have errors like forgetting the first two "magic" parameters
or writing "sequence-item" instead of "_['sequence-item']", and can take
advantage of current dtml-let features such as cascading assignment
(foo=1, bar=foo+1, etc) and future ones such as extended-attribute syntax
(foo-name-name="x" instead of foo="_[_[x]]").

I have considered proposing that we graft dtml-let's capabilities onto the
other tags, so that we could write stuff like:

dtml-var set-foo="getFoo()" var=foo set-param1=" 'text' " set-param2="id"

...or...

dtml-in in="seq" set-seqKey=sequence-key set-letter="seqKey[0]"
   dtml-letter;
/dtml-in

Cheers,

Evan @ digicool  4-am


___
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 )




RE: [Zope] How to Pass values to a DTML method ??

2000-09-12 Thread Dieter Maurer

Stuart Foster writes:
  Dieter Maurer wrote:
   You should include two positional parameters as well:
   
  dtml-var "some_method(_.None,_,param=value)"
  This is the way I had to do it what's up with the two extra params?
DTML objects use the DocumentTemplate's (-- DocumentTemplate.DT_String)
__call__ function for rendering.

This function has two (optional) positional arguments, "client" and
"mapping" and an arbibrary number of keyword parameters.
All these parameters together determine the content of
this magic "namespace" that is used for name resolution inside
the DocumentTemplate.
If you want more details about this, look either at the source
code documentation or search the lists archive for another
post where I explained that in more detail.

For a DTML object "name",
dtml-var name is equivalent to dtml-var "name(_.None,_)",
i.e. the client is "None" and the mapping is the namespace
object "_". This propagates the namespace of the calling
object into the called DTML object.
If you use dtml-var "name(kp1=v1, kp2=v2, ...)", i.e.
you do not provide parameters for the positional parameters,
there use their default value, "None". This implies that
the outer namespace and the corresponding context is not
available in the called DocumentTemplate.



Dieter

___
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 )




Re: [Zope] How to Pass values to a DTML method ??

2000-09-11 Thread Rik Hoekstra




 I have a DTML method that is called from a document. I need to pass a
value
 to it like a parameter would be passed to a function.

 dtml-var some_method(param=value)


try something like:

dtml-var "method_name(_.None, _, param=value)"

or:

dtml-var "method_name(_.None, _, arg1=value1, arg2=value2)"

for a longer expose see the faq:
http://zdp.zope.org/projects/zfaq/faq/DTML/955111628

hth

Rik


___
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 )




Re: [Zope] How to Pass values to a DTML method ??

2000-09-11 Thread Philipp Auersperg

enclose the expression in quotes and you're happy:

dtml-var "some_method(param=value)"

phil

*** REPLY SEPARATOR  ***

On 11.09.2000 at 09:01 Stuart Foster wrote:

I have a DTML method that is called from a document. I need to pass a value
to it like a parameter would be passed to a function.

dtml-var some_method(param=value)

Thanks


___
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 )




___
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 )




Re: [Zope] How to Pass values to a DTML method ??

2000-09-11 Thread Daniel Rusch

dtml-var "some_method(param='Test')"

'Test' is single quoted if it is a string, if it is a variable then
don't quote it. Notice also the double quotes
"some_method(param='Test')"

Dan

Stuart Foster wrote:
 
 I have a DTML method that is called from a document. I need to pass a value
 to it like a parameter would be passed to a function.
 
 dtml-var some_method(param=value)
 
 Thanks
 
 ___
 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 )

___
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 )




Re: [Zope] How to Pass values to a DTML method ??

2000-09-11 Thread Dieter Maurer

Stuart Foster writes:
  I have a DTML method that is called from a document. I need to pass a value
  to it like a parameter would be passed to a function.
  
  dtml-var some_method(param=value)
That does not look too bad, but you forgot the "..." around the call.

You should include two positional parameters as well:

dtml-var "some_method(_.None,_,param=value)"

Otherwise, you cut the namespace propagation.


Dieter

___
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 )




RE: [Zope] How to Pass values to a DTML method ??

2000-09-11 Thread Stuart Foster

This is the way I had to do it what's up with the two extra params?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
Dieter Maurer
Sent: Monday, September 11, 2000 2:24 PM
To: Stuart Foster
Cc: Zope List
Subject: Re: [Zope] How to Pass values to a DTML method ??


Stuart Foster writes:
  I have a DTML method that is called from a document. I need to pass a
value
  to it like a parameter would be passed to a function.
 
  dtml-var some_method(param=value)
That does not look too bad, but you forgot the "..." around the call.

You should include two positional parameters as well:

dtml-var "some_method(_.None,_,param=value)"

Otherwise, you cut the namespace propagation.


Dieter

___
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 )


___
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 )