@@ -76,7 +76,7 @@ def add_machine_key():
7676 expires = form .expires .data ,
7777 readonly = form .readonly .data ,
7878 comment = form .comment .data ,
79- user_id = session ["user_id" ]
79+ user_id = session ["user_id" ],
8080 )
8181
8282 db .session .add (model )
@@ -87,10 +87,7 @@ def add_machine_key():
8787 else :
8888 for field , errors in form .errors .items ():
8989 for error in errors :
90- print (
91- "Error in the %s field - %s"
92- % (getattr (form , field ).label .text , error )
93- )
90+ print ("Error in the %s field - %s" % (getattr (form , field ).label .text , error ))
9491
9592 return render_template ("forms/machine_api_key.html" , form = form , generated_key = generated )
9693
@@ -117,12 +114,8 @@ def delete_machine_key(key_id):
117114@admin_required
118115def user ():
119116 form = UserForm (request .form )
120- form .role_ids .choices = [
121- (g .id , g .name ) for g in db .session .query (Role ).order_by ("name" )
122- ]
123- form .org_ids .choices = [
124- (g .id , g .name ) for g in db .session .query (Organization ).order_by ("name" )
125- ]
117+ form .role_ids .choices = [(g .id , g .name ) for g in db .session .query (Role ).order_by ("name" )]
118+ form .org_ids .choices = [(g .id , g .name ) for g in db .session .query (Organization ).order_by ("name" )]
126119
127120 if request .method == "POST" and form .validate ():
128121 # test if user is unique
@@ -157,12 +150,8 @@ def user():
157150def edit_user (user_id ):
158151 user = db .session .query (User ).get (user_id )
159152 form = UserForm (request .form , obj = user )
160- form .role_ids .choices = [
161- (g .id , g .name ) for g in db .session .query (Role ).order_by ("name" )
162- ]
163- form .org_ids .choices = [
164- (g .id , g .name ) for g in db .session .query (Organization ).order_by ("name" )
165- ]
153+ form .role_ids .choices = [(g .id , g .name ) for g in db .session .query (Role ).order_by ("name" )]
154+ form .org_ids .choices = [(g .id , g .name ) for g in db .session .query (Organization ).order_by ("name" )]
166155
167156 if request .method == "POST" and form .validate ():
168157 user .update (form )
@@ -233,9 +222,7 @@ def organization():
233222 flash ("Organization saved" )
234223 return redirect (url_for ("admin.organizations" ))
235224 else :
236- flash (
237- "Organization {} already exists" .format (form .name .data ), "alert-danger"
238- )
225+ flash ("Organization {} already exists" .format (form .name .data ), "alert-danger" )
239226
240227 action_url = url_for ("admin.organization" )
241228 return render_template (
@@ -391,9 +378,7 @@ def action():
391378 return redirect (url_for ("admin.actions" ))
392379 else :
393380 flash (
394- "Action with name {} or command {} already exists" .format (
395- form .name .data , form .command .data
396- ),
381+ "Action with name {} or command {} already exists" .format (form .name .data , form .command .data ),
397382 "alert-danger" ,
398383 )
399384
@@ -480,9 +465,7 @@ def community():
480465 flash ("Community saved" , "alert-success" )
481466 return redirect (url_for ("admin.communities" ))
482467 else :
483- flash (
484- f"Community with name { form .name .data } already exists" , "alert-danger"
485- )
468+ flash (f"Community with name { form .name .data } already exists" , "alert-danger" )
486469
487470 community_url = url_for ("admin.community" )
488471 return render_template (
@@ -527,9 +510,7 @@ def delete_community(community_id):
527510 try :
528511 db .session .commit ()
529512 except IntegrityError :
530- message = "Community {} is in use in some rules, can not be deleted!" .format (
531- aname
532- )
513+ message = "Community {} is in use in some rules, can not be deleted!" .format (aname )
533514 alert_type = "alert-danger"
534515
535516 flash (message , alert_type )
0 commit comments