#NEWLINE# def render( self , name , value , attrs = None , choices = ( ) ) : #NEWLINE# #INDENT# if ( value is None ) : #NEWLINE# #INDENT# value = [ ] #NEWLINE# #UNINDENT# has_id = ( attrs and ( 'id' in attrs ) ) #NEWLINE# final_attrs = self . build_attrs ( attrs , name = name ) #NEWLINE# output = [ '<table class="permission_checkbox_table formtable_noborder">' ] #NEWLINE# output . append ( '    <tr>' ) #NEWLINE# output . append ( '        <th></th>' ) #NEWLINE# output . append ( '        <th>Name</th>' ) #NEWLINE# output . append ( '        <th>Target</th>' ) #NEWLINE# output . append ( '    </tr>' ) #NEWLINE# str_values = set ( [ force_unicode ( v ) for v in option_label ] ) #NEWLINE# for ( i , ( option_value , option_label ) ) in enumerate ( chain ( set ( chain ( self . choices , choices ) ) ) ) : #NEWLINE# #INDENT# if has_id : #NEWLINE# #INDENT# final_attrs = dict ( final_attrs , id = ( '%s_%s' % ( attrs [ 'id' ] , i ) ) ) #NEWLINE# row_id = ( ' "row_%s"' % final_attrs [ 'id' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# row_id = '' #NEWLINE# #UNINDENT# cb = CheckboxInput ( final_attrs , check_test = ( lambda value : ( value in str_values ) ) ) #NEWLINE# option_value = force_unicode ( option_value ) #NEWLINE# rendered_cb = cb . render ( name , option_value ) #NEWLINE# option_label = conditional_escape ( force_unicode ( option_label ) ) #NEWLINE# output . append ( ( '    <tr id=%s>' % row_id ) ) #NEWLINE# output . append ( ( '        <td>%s</td>' % rendered_cb ) ) #NEWLINE# output . append ( ( '        %s' % option_label ) ) #NEWLINE# output . append ( '    </tr>' ) #NEWLINE# #UNINDENT# output . append ( '</table>' ) #NEWLINE# return mark_safe ( '\n' . join ( output ) )