#NEWLINE# def test_fieldlist_of_fieldsets( self ) : #NEWLINE# #INDENT# 'Accept of fieldlist of readonly fieldsets' #NEWLINE# class _Form ( Form ) : #NEWLINE# #INDENT# fields = [ FieldList ( 'list' , field = FieldSet ( 'set' , fields = [ Field ( 'number' , convs . Int ( ) , permissions = 'r' ) ] ) ) ] #NEWLINE# #UNINDENT# env = AppEnvironment . create ( ) #NEWLINE# form = _Form ( env , initial = { #NEWLINE# #INDENT# 'list' : [ { #NEWLINE# #INDENT# 'number' : 1 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'number' : 2 , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( form . raw_data , MultiDict ( ( ( 'list-indices' , '1' ) , ( 'list-indices' , '2' ) ) , ** { #NEWLINE# #INDENT# 'list.1.number' : '1' , #NEWLINE# 'list.2.number' : '2' , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# self . assertEqual ( form . python_data , { #NEWLINE# #INDENT# 'list' : [ { #NEWLINE# #INDENT# 'number' : 1 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'number' : 2 , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assert_ ( form . accept ( MultiDict ( ( ( 'list-indices' , '1' ) , ( 'list-indices' , '2' ) ) , ** { #NEWLINE# #INDENT# 'list.1.number' : '2' , #NEWLINE# 'list.2.number' : '3' , #NEWLINE# #UNINDENT# } ) ) ) #NEWLINE# self . assertEqual ( form . python_data , { #NEWLINE# #INDENT# 'list' : [ { #NEWLINE# #INDENT# 'number' : 1 , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'number' : 2 , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } )