#NEWLINE# def obj_make_dict_of_lists( context , list_cls , obj_list , item_key ) : #NEWLINE# #INDENT# 'Construct a dictionary of object lists, keyed by item_key.\n\n    :param:context: Request context\n    :param:list_cls: The ObjectListBase class\n    :param:obj_list: The list of objects to place in the dictionary\n    :param:item_key: The object attribute name to use as a dictionary key\n    ' #NEWLINE# obj_lists = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for obj in obj_list : #NEWLINE# #INDENT# key = getattr ( obj , item_key ) #NEWLINE# if ( key not in obj_lists ) : #NEWLINE# #INDENT# obj_lists [ key ] = list_cls ( ) #NEWLINE# obj_lists [ key ] . objects = [ ] #NEWLINE# #UNINDENT# obj_lists [ key ] . objects . append ( obj ) #NEWLINE# #UNINDENT# for key in obj_lists : #NEWLINE# #INDENT# obj_lists [ key ] . _context = context #NEWLINE# obj_lists [ key ] . obj_reset_changes ( ) #NEWLINE# #UNINDENT# return obj_lists