Back to index

plone3  3.1.7
Classes | Functions
plone.app.controlpanel.overview Namespace Reference

Classes

class  OverviewControlPanel

Functions

def three_column_list

Function Documentation

Definition at line 13 of file overview.py.

00013 
00014 def three_column_list(input_list):
00015     list_len = len(input_list)
00016 
00017     # Calculate the length of the sublists
00018     sublist_len = (list_len % 3 == 0 and list_len / 3 or list_len / 3 + 1)
00019 
00020     # Calculate the list end point given the list number
00021     def _list_end(num):
00022         return (num == 2 and list_len or (num + 1) * sublist_len)
00023 
00024     # Generate only filled columns
00025     final = []
00026     for i in range(3):
00027         column = input_list[i*sublist_len:_list_end(i)]
00028         if len(column) > 0:
00029             final.append(column)
00030     return final
00031 

Here is the caller graph for this function: