diff --git a/requirements.txt b/requirements.txt index f75e3771..c7b9a422 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,6 +15,6 @@ gunicorn==22.0.0 selenium==3.14.1 django-oauth-toolkit==1.5.0 django-rest-framework-social-oauth2==1.1.0 -spdx-tools==0.8.2 -ntia-conformance-checker==1.1.0 +spdx-tools==0.8.3 +ntia-conformance-checker==3.0.2 -e git+https://github.com/spdx/spdx-license-matcher.git@v2.7#egg=spdx-license-matcher diff --git a/src/app/core.py b/src/app/core.py index b0504819..c42855d3 100644 --- a/src/app/core.py +++ b/src/app/core.py @@ -1,8 +1,5 @@ """This file contains the core logic used in the SPDX Online Tools' APP and API""" -import json - -from django.http.response import JsonResponse import jpype import os import sys @@ -11,7 +8,7 @@ from django.core.files.storage import FileSystemStorage from django.conf import settings -from json import dumps, loads +from json import dumps from time import time from traceback import format_exc from urllib.parse import urljoin @@ -56,7 +53,7 @@ def license_compare_helper(request): erroroccurred = False warningoccurred = False if (len(request.FILES.getlist("files")) < 2): - context_dict["error"] = "Please select atleast 2 files" + context_dict["error"] = "Please select at least 2 files" result['status'] = 404 result['context'] = context_dict return result @@ -178,7 +175,7 @@ def license_compare_helper(request): """ If no files uploaded""" if (request.is_ajax()): filelist.append("Files not selected.") - errorlist.append("Please select atleast 2 files.") + errorlist.append("Please select at least 2 files.") ajaxdict["files"] = filelist ajaxdict["type"] = "error" ajaxdict["errors"] = errorlist @@ -186,7 +183,7 @@ def license_compare_helper(request): result['status'] = 404 result['response'] = response return result - context_dict["error"] = "Select atleast two files" + context_dict["error"] = "Select at least two files" context_dict["type"] = "error" result['status'] = 404 result['context'] = context_dict @@ -194,7 +191,7 @@ def license_compare_helper(request): def ntia_check_helper(request): """ - A helper function to check the ntia elements in a given file in various formats. + A helper function to check the NTIA elements in a given file in various formats. """ ajaxdict = dict() context_dict = {} @@ -209,8 +206,11 @@ def ntia_check_helper(request): ) filename = fs.save(utils.removeSpecialCharacters(myfile.name), myfile) uploaded_file_url = fs.url(filename).replace("%20", " ") - """ Call the python SBOM Checker """ + """ Get other request parameters """ + # compliance = request.POST.get("compliance", "ntia") # Default: "ntia" + """ Call the Python SBOM Checker """ schecker = SbomChecker(str(settings.APP_DIR + uploaded_file_url)) + # schecker = SbomChecker(str(settings.APP_DIR + uploaded_file_url), compliance=compliance) # Post-3.0.2 oldStdout = sys.stdout tempstdout = StringIO() sys.stdout = tempstdout diff --git a/src/app/templates/app/ntia_conformance_checker.html b/src/app/templates/app/ntia_conformance_checker.html index 06b53d6d..f5f70175 100644 --- a/src/app/templates/app/ntia_conformance_checker.html +++ b/src/app/templates/app/ntia_conformance_checker.html @@ -8,36 +8,38 @@ {% block body1 %}
-

{{ error }}

+

{{ error }}

Tag-Value, RDF, JSON, Spreadsheet, XML SPDX Document

-
- {% csrf_token %} -
-   File Type   - -
-
-

Upload file using the button or by dragging and dropping onto the dashed region

- - -

No file selected

-
-
+
+ {% csrf_token %} +
+   File Type   + +
+
+   Compliance   + +
+
+

Upload file using the button or by dragging and dropping onto the dashed region

+ + +

No file selected

+
+

- + {% include "app/modal.html" %} -
{% endblock %} @@ -45,7 +47,7 @@

Upload file using the button or by dragging and dropping onto the dashed reg {% block script_block %}