Back to index

plone3  3.1.7
formatColumns.py
Go to the documentation of this file.
00001 ##parameters=items,columns=3
00002 ##title=format a list of items into columns for better display
00003 
00004 # returns a list of lists of items
00005 # see folder_localrole_form.pt for an example
00006 
00007 rows=[]
00008 
00009 i=0
00010 l=len(items)
00011 
00012 while 1:
00013     col=[]
00014     for n in range(columns):
00015         if i>=l:
00016             col.append(None)
00017         else:
00018             col.append(items[i])
00019             i=i+1
00020     rows.append(list(col))
00021     if i>=l: break
00022 
00023 return rows
00024