@@ -271,11 +271,8 @@ def new_product(request):
271271 jform = None
272272 if request .method == 'POST' :
273273 form = ProductForm (request .POST , instance = Product ())
274- if hasattr (settings , 'ENABLE_JIRA' ):
275- if settings .ENABLE_JIRA :
274+ if get_system_setting ('enable_jira' ):
276275 jform = JIRAPKeyForm (request .POST , instance = JIRA_PKey ())
277- else :
278- jform = None
279276 else :
280277 jform = None
281278
@@ -288,8 +285,7 @@ def new_product(request):
288285 messages .SUCCESS ,
289286 'Product added successfully.' ,
290287 extra_tags = 'alert-success' )
291- if hasattr (settings , 'ENABLE_JIRA' ):
292- if settings .ENABLE_JIRA :
288+ if get_system_setting ('enable_jira' ):
293289 if jform .is_valid ():
294290 jira_pkey = jform .save (commit = False )
295291 if jira_pkey .conf is not None :
@@ -303,8 +299,7 @@ def new_product(request):
303299 return HttpResponseRedirect (reverse ('view_product' , args = (product .id ,)))
304300 else :
305301 form = ProductForm ()
306- if hasattr (settings , 'ENABLE_JIRA' ):
307- if settings .ENABLE_JIRA :
302+ if get_system_setting ('enable_jira' ):
308303 jform = JIRAPKeyForm ()
309304 else :
310305 jform = None
@@ -337,7 +332,7 @@ def edit_product(request, pid):
337332 'Product updated successfully.' ,
338333 extra_tags = 'alert-success' )
339334
340- if get_system_setting ('enable_jira' ) and jira . enabled :
335+ if get_system_setting ('enable_jira' ) and jira_enabled :
341336 jform = JIRAPKeyForm (request .POST , instance = jira_inst )
342337 #need to handle delete
343338 try :
@@ -361,7 +356,7 @@ def edit_product(request, pid):
361356 initial = {'auth_users' : prod .authorized_users .all (),
362357 'tags' : get_tag_list (Tag .objects .get_for_object (prod ))})
363358
364- if get_system_setting ('jira_enabled' ) :
359+ if get_system_setting ('enable_jira' ) and jira_enabled :
365360 if jira_enabled :
366361 jform = JIRAPKeyForm (instance = jira_inst )
367362 else :
@@ -452,9 +447,7 @@ def new_eng_for_app(request, pid):
452447 else :
453448 new_eng .progress = 'other'
454449 new_eng .save ()
455-
456- if hasattr (settings , 'ENABLE_JIRA' ):
457- if settings .ENABLE_JIRA :
450+ if get_system_setting ('enable_jira' ):
458451 #Test to make sure there is a Jira project associated the product
459452 try :
460453 jform = JIRAFindingForm (request .POST , prefix = 'jiraform' ,
@@ -477,8 +470,7 @@ def new_eng_for_app(request, pid):
477470 return HttpResponseRedirect (reverse ('view_engagement' , args = (new_eng .id ,)))
478471 else :
479472 form = EngForm (initial = {})
480- if hasattr (settings , 'ENABLE_JIRA' ):
481- if settings .ENABLE_JIRA :
473+ if (get_system_setting ('enable_jira' )):
482474 if JIRA_PKey .objects .filter (product = prod ).count () != 0 :
483475 jform = JIRAFindingForm (prefix = 'jiraform' , enabled = JIRA_PKey .objects .get (product = prod ).push_all_issues )
484476
@@ -591,13 +583,12 @@ def ad_hoc_finding(request, pid):
591583 enabled = False
592584 jform = None
593585 form = AdHocFindingForm (initial = {'date' : datetime .now (tz = localtz ).date ()})
594- if hasattr (settings , 'ENABLE_JIRA' ):
595- if settings .ENABLE_JIRA :
586+ if get_system_setting ('enable_jira' ):
596587 if JIRA_PKey .objects .filter (product = test .engagement .product ).count () != 0 :
597588 enabled = JIRA_PKey .objects .get (product = test .engagement .product ).push_all_issues
598589 jform = JIRAFindingForm (enabled = enabled , prefix = 'jiraform' )
599- else :
600- jform = None
590+ else :
591+ jform = None
601592 if request .method == 'POST' :
602593 form = AdHocFindingForm (request .POST )
603594 if form .is_valid ():
0 commit comments