Hello, please tell me how access an list member in a dtml-Method/ Document. per Example, having a list numbers[7,11,13,17,19]. How to get the first item? <dtml-var numbers[0]> results in a KeyError! Why? greetings Axel
Hi, Try <dtml-var expr="number[0]"> -Scott On Wed, Mar 07, 2001 at 02:03:28PM +0100, Axel Missbach wrote:
Hello, please tell me how access an list member in a dtml-Method/ Document.
per Example, having a list numbers[7,11,13,17,19]. How to get the first item?
<dtml-var numbers[0]> results in a KeyError! Why?
greetings Axel
_______________________________________________ Zope maillist - Zope@zope.org 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 )
-- ------------------------------------------------------------------------------- "That's a deer shooting hat." "Like hell it is. This is a people shooting hat. I shoot people in this hat."
Hi, Axel <dtml-var "numbers[0]"> which is short for <dtml-var expr="numbers[0]"> You need to quote python expressions. -- Jim Washington Axel Missbach wrote:
Hello, please tell me how access an list member in a dtml-Method/ Document.
per Example, having a list numbers[7,11,13,17,19]. How to get the first item?
<dtml-var numbers[0]> results in a KeyError! Why?
<dtml-var "numbers[0]"> ----- Original Message ----- From: "Axel Missbach" <Axel.Missbach@t-online.de> To: <zope@zope.org> Sent: Wednesday, March 07, 2001 1:03 PM Subject: [Zope] list access
Hello, please tell me how access an list member in a dtml-Method/ Document.
per Example, having a list numbers[7,11,13,17,19]. How to get the first item?
<dtml-var numbers[0]> results in a KeyError! Why?
greetings Axel
_______________________________________________ Zope maillist - Zope@zope.org 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 )
Axel Missbach wrote:
Hello, please tell me how access an list member in a dtml-Method/ Document.
per Example, having a list numbers[7,11,13,17,19]. How to get the first item?
<dtml-var numbers[0]> results in a KeyError! Why?
greetings Axel
<dtml-var numbers[0]> is equivilant to <dtml-var name="numbers[0]">. What you are writing is a (short) expression. Try: <dtml-var expr="numbers[0]"> You have stumbled upon the reason why the shorthand notation: <dtml-var x> and <dtml-var "x"> is discouraged in favor of <dtml-var name="x"> and <dtml-var expr="x"> respectively. They may be longer, but they are much more explicit. -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
participants (5)
-
Axel.Missbach@t-online.de -
Casey Duncan -
Jim Washington -
Phil Harris -
Scott Barron