#NEWLINE# def process_form( self , prefix , items_function , action_function ) : #NEWLINE# #INDENT# if ( ( '%s-submit' % prefix ) in self . request . POST . keys ( ) ) : #NEWLINE# #INDENT# form = ChoiceForm ( self . request . POST , prefix = prefix , choices = items_function ( ) ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# for selection in form . cleaned_data [ 'selection' ] : #NEWLINE# #INDENT# if self . grouped : #NEWLINE# #INDENT# flat_list = [ ] #NEWLINE# for group in items_function ( ) : #NEWLINE# #INDENT# flat_list . extend ( group [ 1 ] ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# flat_list = items_function ( ) #NEWLINE# #UNINDENT# label = dict ( flat_list ) [ selection ] #NEWLINE# if self . decode_content_type : #NEWLINE# #INDENT# ( model , pk ) = selection . split ( ',' ) #NEWLINE# selection_obj = ContentType . objects . get ( model = model ) . get_object_for_this_type ( pk = pk ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# selection_obj = selection #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# action_function ( selection_obj ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# if settings . DEBUG : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# messages . error ( self . request , ( _ ( 'Unable to transfer selection: %s.' ) % label ) )