#NEWLINE# @ question_proc ( 'choice-multiple' , 'choice-multiple-freeform' ) #NEWLINE# def question_multiple( request , question ) : #NEWLINE# #INDENT# key = ( 'question_%s' % question . number ) #NEWLINE# choices = [ ] #NEWLINE# counter = 0 #NEWLINE# cd = question . getcheckdict ( ) #NEWLINE# defaults = cd . get ( 'default' , '' ) . split ( ',' ) #NEWLINE# for choice in question . choices ( ) : #NEWLINE# #INDENT# counter += 1 #NEWLINE# key = ( 'question_%s_multiple_%d' % ( question . number , choice . sortid ) ) #NEWLINE# if ( ( key in request . POST ) or ( ( request . method == 'GET' ) and ( choice . value in defaults ) ) ) : #NEWLINE# #INDENT# choices . append ( ( choice , key , ' checked' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# choices . append ( ( choice , key , '' ) ) #NEWLINE# #UNINDENT# #UNINDENT# extracount = int ( cd . get ( 'extracount' , 0 ) ) #NEWLINE# if ( ( not extracount ) and ( question . type == 'choice-multiple-freeform' ) ) : #NEWLINE# #INDENT# extracount = 1 #NEWLINE# #UNINDENT# extras = [ ] #NEWLINE# for x in range ( 1 , ( extracount + 1 ) ) : #NEWLINE# #INDENT# key = ( 'question_%s_more%d' % ( question . number , x ) ) #NEWLINE# if ( key in request . POST ) : #NEWLINE# #INDENT# extras . append ( ( key , request . POST [ key ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# extras . append ( ( key , '' ) ) #NEWLINE# #UNINDENT# #UNINDENT# return { #NEWLINE# #INDENT# 'choices' : choices , #NEWLINE# 'extras' : extras , #NEWLINE# 'template' : 'questionnaire/choice-multiple-freeform.html' , #NEWLINE# 'required' : ( cd . get ( 'required' , False ) and ( cd . get ( 'required' ) != '0' ) ) , #NEWLINE# #UNINDENT# }