#NEWLINE# def save( self , event = None , data = None ) : #NEWLINE# #INDENT# if ( not data ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# 'name' : 'Some event' , #NEWLINE# 'locations-0-name' : 'Some location' , #NEWLINE# 'locations-0-description' : 'Some description' , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( not event ) : #NEWLINE# #INDENT# event = self . Event ( ) #NEWLINE# self . session . add ( event ) #NEWLINE# form = self . EventForm ( MultiDict ( event ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# form = self . EventForm ( MultiDict ( data ) , obj = event ) #NEWLINE# #UNINDENT# form . validate ( ) #NEWLINE# form . populate_obj ( event ) #NEWLINE# self . session . commit ( ) #NEWLINE# return event