[Zope] addng a list of users

John Hunter jdhunter@ace.bsd.uchicago.edu
Tue, 14 May 2002 09:04:26 -0500


>>>>> "Paul" == Paul Zwarts <paz@oratrix.com> writes:

    Paul> Try this: <dtml-in expr="['def','ghk','lmn']"> <dtml-call
    Paul> expr="REQUEST.set('name',_['sequence-item'])">

Hi Paul.  

I know the namespace dictionary lookup _['sequence-item'] syntax, but
don't like it.  That's why I used the prefix=user option above.

I find 

  <dtml-in "('abc', 'pdq', 'someuser')" prefix=user>
    <dtml-call "REQUEST.set('name', user_item)">
  </dtml-in>

more readable than

  <dtml-in "('abc', 'pdq', 'someuser')">
    <dtml-call "REQUEST.set('name', _['sequence-item'])">
  </dtml-in>

Both are perfectly valid; it's a question of style.  I also like the
prefix syntax because it makes nested dtml loops easier, preserving
the ability to refer to the items in the outer loops.  

      <dtml-in "Sections.objectValues('Section')"
	       prefix="section" sort="id">
         <dtml-in "section_item.objectValues('Student')" 
		  prefix="student" sort="talk_datetime">

           <dtml-comment>
             Make table rows alternate color based on section
           </dtml-comment>
           <dtml-if section_even>
	     <tr bgcolor=<dtml-var color_section_even>>
	   <dtml-else>
	     <tr bgcolor=<dtml-var color_section_odd>>
	   </dtml-if>

                <td>Blah></td>
             </tr>

         </dtml-in>
       </dtml-in>

Thanks,
John Hunter