Skip to content

Commit

Permalink
Merge pull request #1491 from Bidaya0/feat/new-sca-impl-scan-scan-add…
Browse files Browse the repository at this point in the history
…-field-fix-type-infer

fix: type infer in license.
  • Loading branch information
Bidaya0 authored Jun 6, 2023
2 parents 31a1f00 + 9388020 commit c518de2
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 21 deletions.
26 changes: 19 additions & 7 deletions dongtai_conf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,37 +404,49 @@ def safe_execute(default, exception, function, *args):
'loggers': {
'django.db.backends': {
'handlers': ['console'],
'level': LOGGING_LEVEL,
'level': "DEBUG" if DEBUG else LOGGING_LEVEL,
'propagate': False,
'encoding': "utf-8",
},
'dongtai-webapi': {
'handlers': ['console', ],
'handlers': [
'console',
],
'propagate': True,
'level': LOGGING_LEVEL,
},
'dongtai.openapi': {
'handlers': ['console', ],
'handlers': [
'console',
],
'propagate': True,
'level': LOGGING_LEVEL,
},
'dongtai-core': {
'handlers': ['console', ],
'handlers': [
'console',
],
'propagate': True,
'level': LOGGING_LEVEL,
},
'django': {
'handlers': ['console', ],
'handlers': [
'console',
],
'level': LOGGING_LEVEL,
'propagate': True,
},
'dongtai-engine': {
'handlers': ['console', ],
'handlers': [
'console',
],
'propagate': True,
'level': LOGGING_LEVEL,
},
'celery.apps.worker': {
'handlers': ['console', ],
'handlers': [
'console',
],
'propagate': True,
'level': LOGGING_LEVEL,
},
Expand Down
6 changes: 3 additions & 3 deletions dongtai_web/dongtai_sca/scan/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ def test_update_one_sca_java_result_search3(self):
"/Users/xxx/spring-boot/2.3.2.RELEASE/com.amazon.redshift:redshift-jdbc42.jar",
"9179edbad62154d04d4be20f0c0e2fb1fc637710",
"com.amazon.redshift:redshift-jdbc42.jar", "SHA-1")
def test_update_one_sca_java_result_search3(self):

def test_update_one_sca_java_result_search4(self):
new_update_one_sca(
self.agent_id,
"/Users/xxx/spring-boot/2.3.2.RELEASE/com.amazon.redshift:redshift-jdbc42.jar",
"5a7674517dd621cc60a000898341b03c41b7034b",
"com.amazon.redshift:redshift-jdbc42.jar", "SHA-1")

def test_update_one_sca_java_same_package(self):
new_update_one_sca(
self.agent_id,
Expand Down
8 changes: 5 additions & 3 deletions dongtai_web/dongtai_sca/scan/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,9 +921,11 @@ def get_license_list(license_list_str: str) -> List[Dict]:


def get_license_list_v2(license_list: Tuple[str]) -> List[Dict]:
res = list(
filter(lambda x: x is not None,
map(lambda x: LICENSE_DICT.get(x, None), license_list)))
filter_none: Callable[[Optional[Dict]], bool] = lambda x: x is not None
res = [
LICENSE_DICT[license] for license in license_list
if license in LICENSE_DICT
]
return res
#return [{
# 'identifier': "无",
Expand Down
12 changes: 6 additions & 6 deletions dongtai_web/dongtai_sca/views/newpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ def post(self, request):
except ValidationError as e:
return R.failure(data=e.detail)
q = Q()
if 'level_id' in ser.validated_data:
q = q & Q(level_id__in=ser.validated_data['level_id'])
if 'language_id' in ser.validated_data:
q = q & Q(language_id__in=ser.validated_data['language_id'])
if 'license_id' in ser.validated_data:
q = q & Q(license_id__in=ser.validated_data['license_id'])
if 'level_ids' in ser.validated_data:
q = q & Q(level_id__in=ser.validated_data['level_ids'])
if 'language_ids' in ser.validated_data:
q = q & Q(language_id__in=ser.validated_data['language_ids'])
if 'license_ids' in ser.validated_data:
q = q & Q(license_id__in=ser.validated_data['license_ids'])
if 'project_id' in ser.validated_data:
q = q & Q(assetv2__project_id=ser.validated_data['project_id'])
if 'project_version_id' in ser.validated_data:
Expand Down
4 changes: 2 additions & 2 deletions dongtai_web/dongtai_sca/views/newpackagesummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def get(self, request):
license_q = license_q & Q(
asset__assetv2__project_id=ser.validated_data['project_id'])
if 'project_version_id' in ser.validated_data:
q = q & Q(
assetv2__project_version_id=ser.validated_data['project_id'])
q = q & Q(assetv2__project_version_id=ser.
validated_data['project_version_id'])
license_q = license_q & Q(asset__assetv2__project_version_id=ser.
validated_data['project_version_id'])
queryset = AssetV2Global.objects.filter(q)
Expand Down

0 comments on commit c518de2

Please sign in to comment.