[Zope] Multiple selection and looping
Paul Zwarts
paz@oratrix.com
Fri, 13 Jul 2001 16:11:36 +0200
Maybe you should answer the question then,
What is article_connection? Why I ask is that first you try to in something
called 'article_connection', then we see it to be 'connection'. Article is a
ZClass with a property called connection? Connection is a method, article is
the method? I'm as confused as you are....
Python, in my basic understanding is a relational grouping of anything. If
an object contains a subobject, you refer to it as something like
itemA.subItemA
The _.getitem() works as if you have a document called DOCA, you can put it
inside a variable tag like <dtml-var "_.getitem(DOCA)">
In case of a ZClass (which I tell you truthfully is beyond my scope right
now, Im still oin ZSQL world comepletely) you need to the parent object to
call its child object.
Warning: I am ignorant in python. I wrote my first totally python script
today that will take a directory of files and a list of pairs, find and
replace the first of pair with second, then write all the files back to the
directory. I'm beside myself with excitement at my first step, so I'm not
the person to ask for technical accuracy. I just happen to be more wordy
than those who understand these concepts in the form of reference
contraindications and argument descriptions.
Success,
Paz
-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
Benoit DOMINIAK
Sent: Friday, July 13, 2001 2:42 PM
To: laurien@tiger.3dem.bioch.bcm.tmc.edu
Cc: zope@zope.org
Subject: [Zope] Multiple selection and looping
Sorry but it doesn't work :
Error Type: KeyError
Error Value: ['communication', 'distribution_channel', 'market_trends']
File C:\Program Files\zope\lib\python\DocumentTemplate\DT_Util.py, line 334,
in eval
(Object: _.getitem(connection))
(Info: _)
File <string>, line 0, in ?
KeyError: (see above)
-------------------------------------------------------------------
Any idea ?
Laurie said :
I think that either article_connection, or connection are not lists at the
moment - you probably have to use
"_.getitem(<<<<either connection or article_connection>>>>>)" to evaluate
the string into something that in can iterate over.
hth,
Laurie
-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
Benoit DOMINIAK
Sent: Friday, July 13, 2001 5:07 AM
To: zope@zope.org
Subject: [Zope] Multiple selection and looping
Hi everybody,
I made a Zclass with a multiple selection property "connection" and I want
to create checkboxes wich must be checked if the value of the checkbox is
one of the value of "connection".
Here is my code (with a little help from my friend Laurie ;-) :
<dtml-in "article_connection">
<input type=checkbox name=connection value="<dtml-var sequence-item>"
<dtml-call expr="REQUEST.set('mylistitem',_['sequence-item'])">
<dtml-in connection>
<dtml-if expr="_['sequence-item'] == mylistitem">
checked
</dtml-if>>
</dtml-in>
<dtml-var sequence-item><br>
</dtml-in>
It sounded good BUT :
Error Type: InError
Error Value: Strings are not allowed as input to the in tag.
Can somebody help me ??
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
_______________________________________________
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 )