#NEWLINE# def post( self , entity_id = None ) : #NEWLINE# #INDENT# 'HTML POST handler. \n    \n    Save changes to the given monster.' #NEWLINE# template_values = self . build_template_values ( ) #NEWLINE# if entity_id : #NEWLINE# #INDENT# monster = Monster . get_by_id_safe ( int ( entity_id ) , template_values [ handlers . base . PROFILE_KEY ] ) #NEWLINE# if monster : #NEWLINE# #INDENT# user = users . get_current_user ( ) #NEWLINE# if ( monster . creator . account == user ) : #NEWLINE# #INDENT# monster . name = self . request . get ( 'name' ) #NEWLINE# monster . hp = self . request . get ( 'hp' ) #NEWLINE# monster . armor = self . request . get ( 'armor' ) #NEWLINE# monster . damage = self . request . get ( 'damage' ) #NEWLINE# monster . instinct = self . request . get ( 'instinct' ) #NEWLINE# monster . description = self . request . get ( 'description' ) #NEWLINE# nextindex = 0 #NEWLINE# monster . tags = [ ] #NEWLINE# while self . request . get ( ( 'tag-' + str ( nextindex ) ) ) : #NEWLINE# #INDENT# monster . tags . append ( self . request . get ( ( 'tag-' + str ( template ) ) ) ) #NEWLINE# nextindex += 1 #NEWLINE# #UNINDENT# nextindex = 0 #NEWLINE# monster . special_qualities = [ ] #NEWLINE# while self . request . get ( ( 'specialquality-' + str ( nextindex ) ) ) : #NEWLINE# #INDENT# monster . special_qualities . append ( self . request . get ( ( 'specialquality-' + str ( nextindex ) ) ) ) #NEWLINE# nextindex += 1 #NEWLINE# #UNINDENT# nextindex = 0 #NEWLINE# monster . damage_tags = [ ] #NEWLINE# while self . request . get ( ( 'damagetag-' + str ( nextindex ) ) ) : #NEWLINE# #INDENT# monster . damage_tags . append ( self . request . get ( ( 'damagetag-' + str ( nextindex ) ) ) ) #NEWLINE# nextindex += 1 #NEWLINE# #UNINDENT# nextindex = 0 #NEWLINE# monster . moves = [ ] #NEWLINE# while self . request . get ( ( 'move-' + str ( nextindex ) ) ) : #NEWLINE# #INDENT# monster . moves . append ( self . request . get ( ( 'move-' + str ( nextindex ) ) ) ) #NEWLINE# nextindex += 1 #NEWLINE# #UNINDENT# monster . edited = True #NEWLINE# monster . put ( ) #NEWLINE# return self . redirect ( self . uri_for ( 'monster' , entity_id = monster . key ( ) . id ( ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return self . forbidden ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return self . not_found ( ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return self . not_found ( ) #NEWLINE# #UNINDENT# template = configuration . site . jinja_environment . get_template ( 'monster/edit.html' ) #NEWLINE# self . response . write ( template . render ( template_values ) )