Hi John, Try this: <dtml-in expr="['def','ghk','lmn']"> <dtml-call expr="REQUEST.set('name',_['sequence-item'])"> The _ trick prevents zope from trying to subtract item from sequence. Cheers, Paz -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org] On Behalf Of Bill Kerr Sent: Monday, May 13, 2002 10:31 PM To: John Hunter Cc: zope@zope.org Subject: Re: [Zope] addng a list of users From: "John Hunter"
The loop has to be outside the dtml-calls, and you can refer to the individual items with sequence-item, or in the case below, with 'user_item' (I prefer to use prefixes with my dtml-in tags because I think it makes the code more readable and easier to integrate with python calls)
<dtml-var standard_html_header> <h2><dtml-var title_or_id></h2> <dtml-in "('abc', 'pdq', 'someuser')" prefix=user> <dtml-call "REQUEST.set('name', user_item)"> <dtml-call "REQUEST.set('password','change')"> <dtml-call "REQUEST.set('confirm','change')"> <dtml-call "REQUEST.set('domains',[])"> <dtml-call "REQUEST.set('roles',['noRole'])"> <dtml-call "acl_users.manage_users('Add',REQUEST,RESPONSE)"> The user <dtml-var user_item> has been added. </dtml-in> <dtml-var standard_html_footer>
I think the list should be in square brackets not round brackets ie. <dtml-in "['abc', 'pdq', 'someuser']" prefix=user> not <dtml-in "('abc', 'pdq', 'someuser')" prefix=user> I've just tried your suggestion, John, but no joy, unfortunately (tried round brackets too but still didn't work) Error Type: NameError Error Value: global name 'user' is not defined Also tried <dtml-var standard_html_header> <h2><dtml-var title_or_id></h2> <dtml-in expr="['def','ghk','lmn']"> <dtml-call expr="REQUEST.set('roles',['noRole'])"> <dtml-call expr="REQUEST.set('name',sequence-item)"> <dtml-call expr="REQUEST.set('password','change')"> <dtml-call expr="REQUEST.set('confirm','change')"> <dtml-call expr="REQUEST.set('domains',[])"> <dtml-call expr="acl_users.manage_users('Add',REQUEST,RESPONSE)"> The user <dtml-var sequence-item> has been added. </dtml-in> <dtml-var standard_html_footer> This generated a similar sort of error message: Error Type: NameError Error Value: global name 'sequence' is not defined -Bill Kerr
Hope this helps, John Hunter
_______________________________________________ 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 )