@@ -108,7 +108,7 @@ def license_compare_helper(request):
108108 compareclass .onlineFunction (callfunc )
109109 except Exception as ex :
110110 """Error raised by onlineFunction"""
111- if ( request .is_ajax () ):
111+ if utils .is_ajax (request ):
112112 ajaxdict ["type" ] = "warning2"
113113 ajaxdict ["files" ] = filelist
114114 ajaxdict ["errors" ] = errorlist
@@ -124,7 +124,7 @@ def license_compare_helper(request):
124124 return result
125125 if (warningoccurred == False ):
126126 """If no warning raised """
127- if ( request .is_ajax () ):
127+ if utils .is_ajax (request ):
128128 ajaxdict ["medialink" ] = settings .MEDIA_URL + folder + "/" + rfilename
129129 response = dumps (ajaxdict )
130130 result ['response' ] = response
@@ -136,7 +136,7 @@ def license_compare_helper(request):
136136 result ['context' ] = context_dict
137137 return result
138138 else :
139- if ( request .is_ajax () ):
139+ if utils .is_ajax (request ):
140140 ajaxdict ["type" ] = "warning"
141141 ajaxdict ["files" ] = filelist
142142 ajaxdict ["errors" ] = errorlist
@@ -153,7 +153,7 @@ def license_compare_helper(request):
153153 result ['context' ] = context_dict
154154 return result
155155 else :
156- if ( request .is_ajax () ):
156+ if utils .is_ajax (request ):
157157 ajaxdict ["files" ] = filelist
158158 ajaxdict ["type" ] = "error"
159159 ajaxdict ["errors" ] = errorlist
@@ -175,7 +175,7 @@ def license_compare_helper(request):
175175
176176 except MultiValueDictKeyError :
177177 """ If no files uploaded"""
178- if ( request .is_ajax () ):
178+ if utils .is_ajax (request ):
179179 filelist .append ("Files not selected." )
180180 errorlist .append ("Please select at least 2 files." )
181181 ajaxdict ["files" ] = filelist
@@ -229,7 +229,7 @@ def ntia_check_helper(request):
229229 retval = tempstdout .getvalue ().replace ("," ,", " ).replace ("\n " ,"<br/>" )
230230 if not retval .startswith ("No components with missing information." ):
231231 """ If any warnings are returned """
232- if ( request .is_ajax () ):
232+ if utils .is_ajax (request ):
233233 ajaxdict ["type" ] = "warning"
234234 warnings = str (retval )
235235 ajaxdict ["data" ] = "The following warning(s) were raised:<br />\n " + warnings .replace ('\n ' , '<br />\n ' )
@@ -241,7 +241,7 @@ def ntia_check_helper(request):
241241 result ['context' ] = context_dict
242242 result ['status' ] = 400
243243 return result
244- if ( request .is_ajax () ):
244+ if utils .is_ajax (request ):
245245 """ Valid SPDX Document """
246246 ajaxdict ["data" ] = "This SPDX Document is valid:\n " + retval
247247 response = dumps (ajaxdict )
@@ -254,7 +254,7 @@ def ntia_check_helper(request):
254254 return result
255255 else :
256256 """ If no file uploaded."""
257- if ( request .is_ajax () ):
257+ if utils .is_ajax (request ):
258258 ajaxdict = dict ()
259259 ajaxdict ["type" ] = "error"
260260 ajaxdict ["data" ] = "No file uploaded"
@@ -268,7 +268,7 @@ def ntia_check_helper(request):
268268 return result
269269 except jpype .JException as ex :
270270 """ Error raised by check_anything.check_minimum_elements without exiting the application"""
271- if ( request .is_ajax () ):
271+ if utils .is_ajax (request ):
272272 ajaxdict = dict ()
273273 ajaxdict ["type" ] = "error"
274274 ajaxdict ["data" ] = jpype .JException .message (ex )
@@ -282,7 +282,7 @@ def ntia_check_helper(request):
282282 return result
283283 except MultiValueDictKeyError :
284284 """ If no files selected"""
285- if ( request .is_ajax () ):
285+ if utils .is_ajax (request ):
286286 ajaxdict = dict ()
287287 ajaxdict ["type" ] = "error"
288288 ajaxdict ["data" ] = "No files selected."
@@ -296,7 +296,7 @@ def ntia_check_helper(request):
296296 return result
297297 except Exception as ex :
298298 """ Other error raised """
299- if ( request .is_ajax () ):
299+ if utils .is_ajax (request ):
300300 ajaxdict = dict ()
301301 ajaxdict ["type" ] = "error"
302302 ajaxdict ["data" ] = format_exc ()
@@ -336,7 +336,7 @@ def license_validate_helper(request):
336336 retval = verifyclass .verify (str (settings .APP_DIR + uploaded_file_url ), fileformat )
337337 if (len (retval ) > 0 ):
338338 """ If any warnings are returned """
339- if ( request .is_ajax () ):
339+ if utils .is_ajax (request ):
340340 ajaxdict ["type" ] = "warning"
341341 warnings = str (retval )
342342 ajaxdict ["data" ] = "The following warning(s) were raised:<br />\n " + warnings .replace ('\n ' , '<br />\n ' )
@@ -348,7 +348,7 @@ def license_validate_helper(request):
348348 result ['context' ] = context_dict
349349 result ['status' ] = 400
350350 return result
351- if ( request .is_ajax () ):
351+ if utils .is_ajax (request ):
352352 """ Valid SPDX Document """
353353 ajaxdict ["data" ] = "This SPDX Document is valid."
354354 response = dumps (ajaxdict )
@@ -361,7 +361,7 @@ def license_validate_helper(request):
361361 return result
362362 else :
363363 """ If no file uploaded."""
364- if ( request .is_ajax () ):
364+ if utils .is_ajax (request ):
365365 ajaxdict = dict ()
366366 ajaxdict ["type" ] = "error"
367367 ajaxdict ["data" ] = "No file uploaded"
@@ -375,7 +375,7 @@ def license_validate_helper(request):
375375 return result
376376 except jpype .JException as ex :
377377 """ Error raised by verifyclass.verify without exiting the application"""
378- if ( request .is_ajax () ):
378+ if utils .is_ajax (request ):
379379 ajaxdict = dict ()
380380 ajaxdict ["type" ] = "error"
381381 ajaxdict ["data" ] = jpype .JException .message (ex )
@@ -389,7 +389,7 @@ def license_validate_helper(request):
389389 return result
390390 except MultiValueDictKeyError :
391391 """ If no files selected"""
392- if ( request .is_ajax () ):
392+ if utils .is_ajax (request ):
393393 ajaxdict = dict ()
394394 ajaxdict ["type" ] = "error"
395395 ajaxdict ["data" ] = "No files selected."
@@ -403,7 +403,7 @@ def license_validate_helper(request):
403403 return result
404404 except Exception as ex :
405405 """ Other error raised """
406- if ( request .is_ajax () ):
406+ if utils .is_ajax (request ):
407407 ajaxdict = dict ()
408408 ajaxdict ["type" ] = "error"
409409 ajaxdict ["data" ] = format_exc ()
@@ -428,7 +428,7 @@ def license_check_helper(request):
428428 try :
429429 matchingId , matchingType , _ = utils .check_spdx_license (licensetext )
430430 if not matchingId :
431- if ( request .is_ajax () ):
431+ if utils .is_ajax (request ):
432432 ajaxdict = dict ()
433433 ajaxdict ["data" ] = "There are no matching SPDX listed licenses"
434434 response = dumps (ajaxdict )
@@ -444,7 +444,7 @@ def license_check_helper(request):
444444 if isinstance (matchingId , list ):
445445 matchingId = "," .join (matchingId )
446446 matching_str += matchingId
447- if request .is_ajax ():
447+ if utils .is_ajax (request ):
448448 ajaxdict = dict ()
449449 ajaxdict ["data" ] = matching_str
450450 response = dumps (ajaxdict )
@@ -457,7 +457,7 @@ def license_check_helper(request):
457457 return result
458458 except jpype .JException as ex :
459459 """ Java exception raised without exiting the application """
460- if request .is_ajax ():
460+ if utils .is_ajax (request ):
461461 ajaxdict = dict ()
462462 ajaxdict ["data" ] = jpype .JException .message (ex )
463463 response = dumps (ajaxdict )
@@ -470,7 +470,7 @@ def license_check_helper(request):
470470 return result
471471 except Exception as ex :
472472 """ Other exception raised """
473- if request .is_ajax ():
473+ if utils .is_ajax (request ):
474474 ajaxdict = dict ()
475475 ajaxdict ["data" ] = format_exc ()
476476 response = dumps (ajaxdict )
@@ -517,7 +517,7 @@ def license_convert_helper(request):
517517 warnings = verifyclass .verify (str (settings .MEDIA_ROOT + "/" + folder + "/" + "/" + convertfile ), toFileFormat )
518518 if (len (warnings ) == 0 ) :
519519 """ If no warnings raised """
520- if ( request .is_ajax () ):
520+ if utils .is_ajax (request ):
521521 ajaxdict ["medialink" ] = settings .MEDIA_URL + folder + "/" + convertfile
522522 response = dumps (ajaxdict )
523523 result ['response' ] = response
@@ -529,7 +529,7 @@ def license_convert_helper(request):
529529 result ['status' ] = 200
530530 return result
531531 else :
532- if ( request .is_ajax () ):
532+ if utils .is_ajax (request ):
533533 ajaxdict ["type" ] = "warning"
534534 warnings = str (warnings )
535535 ajaxdict ["data" ] = "The following warning(s) were raised by " + myfile .name + ":<br />\n " + warnings .replace ('\n ' , '<br />\n ' )
@@ -554,7 +554,7 @@ def license_convert_helper(request):
554554 return result
555555 except jpype .JException as ex :
556556 """ Java exception raised without exiting the application"""
557- if ( request .is_ajax () ):
557+ if utils .is_ajax (request ):
558558 ajaxdict ["type" ] = "error"
559559 ajaxdict ["data" ] = jpype .JException .message (ex )
560560 response = dumps (ajaxdict )
@@ -568,7 +568,7 @@ def license_convert_helper(request):
568568 return result
569569 except MultiValueDictKeyError :
570570 """ If no files uploaded"""
571- if ( request .is_ajax () ):
571+ if utils .is_ajax (request ):
572572 ajaxdict ["type" ] = "error"
573573 ajaxdict ["data" ] = "No files selected."
574574 response = dumps (ajaxdict )
@@ -582,7 +582,7 @@ def license_convert_helper(request):
582582 return result
583583 except Exception as ex :
584584 """ Other error raised """
585- if ( request .is_ajax () ):
585+ if utils .is_ajax (request ):
586586 ajaxdict ["type" ] = "error"
587587 ajaxdict ["data" ] = format_exc ()
588588 response = dumps (ajaxdict )
@@ -624,7 +624,7 @@ def license_diff_helper(request):
624624 return data
625625 except jpype .JException as ex :
626626 """ Java exception raised without exiting the application """
627- if ( request .is_ajax () ):
627+ if utils .is_ajax (request ):
628628 ajaxdict = dict ()
629629 ajaxdict ["data" ] = jpype .JException .message (ex )
630630 response = dumps (ajaxdict )
@@ -637,7 +637,7 @@ def license_diff_helper(request):
637637 return data
638638 except Exception as ex :
639639 """ Other exception raised """
640- if ( request .is_ajax () ):
640+ if utils .is_ajax (request ):
641641 ajaxdict = dict ()
642642 ajaxdict ["data" ] = format_exc ()
643643 response = dumps (ajaxdict )
0 commit comments