[Zope] addng a list of users
John Hunter
jdhunter@ace.bsd.uchicago.edu
Mon, 13 May 2002 08:40:55 -0500
>>>>> "Bill" == Bill Kerr <kerrb@senet.com.au> writes:
Bill> How could I alter the code of this method (from the Book of
Bill> Zope, p. 122) so as to add multiple users from a list?
Bill> Where I have 'abc' (adds one user abc) I want to add more
Bill> than one user simultaneously (abc, xyz etc.), all with the
Bill> same PW, role and domain. I tried inserting <dtml-in
Bill> expr="['abc','xyz']"> where the 'abc' is and put </dtml-in>
Bill> in the second last line but that generated a Parse Error
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>
Hope this helps,
John Hunter