#NEWLINE# def post( self , group_id = None , name = None ) : #NEWLINE# #INDENT# group = Group . get ( self . session , group_id , name ) #NEWLINE# if ( not group ) : #NEWLINE# #INDENT# return self . notfound ( ) #NEWLINE# #UNINDENT# if ( not self . current_user . can_manage ( group ) ) : #NEWLINE# #INDENT# return self . forbidden ( ) #NEWLINE# #UNINDENT# form = GroupEditForm ( self . request . arguments , obj = name ) #NEWLINE# if ( not form . validate ( ) ) : #NEWLINE# #INDENT# return self . render ( 'group-edit.html' , group = group , form = form , alerts = self . get_form_alerts ( form . errors ) ) #NEWLINE# #UNINDENT# group . groupname = form . data [ 'groupname' ] #NEWLINE# group . description = form . data [ 'description' ] #NEWLINE# group . canjoin = form . data [ 'canjoin' ] #NEWLINE# Counter . incr ( self . session , 'updates' ) #NEWLINE# try : #NEWLINE# #INDENT# self . session . commit ( ) #NEWLINE# #UNINDENT# except IntegrityError : #NEWLINE# #INDENT# self . session . rollback ( ) #NEWLINE# form . groupname . errors . append ( '{} already exists' . format ( form . data [ 'groupname' ] ) ) #NEWLINE# return self . render ( 'group-edit.html' , group = group , form = form , alerts = self . get_form_alerts ( form . errors ) ) #NEWLINE# #UNINDENT# AuditLog . log ( self . session , self . current_user . id , 'edit_group' , 'Edited group.' , on_group_id = group . id ) #NEWLINE# return self . redirect ( '/groups/{}' . format ( group . name ) )