[Zope] addng a list of users
Bill Kerr
kerrb@senet.com.au
Tue, 14 May 2002 06:00:40 +0930
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