@@ -437,7 +437,7 @@ def has_permission(self, request, view):
437
437
)
438
438
elif engagement_id := converted_dict .get ("engagement_id" ):
439
439
# engagement_id doesn't exist
440
- msg = f" Engagement \ "{ engagement_id } \ " does not exist"
440
+ msg = f' Engagement "{ engagement_id } " does not exist'
441
441
raise serializers .ValidationError (msg )
442
442
443
443
if not converted_dict .get ("auto_create_context" ):
@@ -492,7 +492,7 @@ def has_permission(self, request, view):
492
492
)
493
493
elif product_id := converted_dict .get ("product_id" ):
494
494
# product_id doesn't exist
495
- msg = f" Product \ "{ product_id } \ " does not exist"
495
+ msg = f' Product "{ product_id } " does not exist'
496
496
raise serializers .ValidationError (msg )
497
497
else :
498
498
msg = "Need product_id or product_name to perform import"
@@ -633,7 +633,7 @@ def has_permission(self, request, view):
633
633
)
634
634
elif test_id := converted_dict .get ("test_id" ):
635
635
# test_id doesn't exist
636
- msg = f" Test \ "{ test_id } \ " does not exist"
636
+ msg = f' Test "{ test_id } " does not exist'
637
637
raise serializers .ValidationError (msg )
638
638
639
639
if not converted_dict .get ("auto_create_context" ):
@@ -927,28 +927,28 @@ def raise_no_auto_create_import_validation_error(
927
927
raise ValidationError (msg )
928
928
929
929
if product_type_name and not product_type :
930
- msg = f" Product Type \ "{ product_type_name } \ " does not exist"
930
+ msg = f' Product Type "{ product_type_name } " does not exist'
931
931
raise serializers .ValidationError (msg )
932
932
933
933
if product_name and not product :
934
934
if product_type_name :
935
- msg = f" Product \ "{ product_name } \ " does not exist in Product_Type \ "{ product_type_name } \" "
935
+ msg = f' Product "{ product_name } " does not exist in Product_Type "{ product_type_name } "'
936
936
raise serializers .ValidationError (msg )
937
937
else :
938
- msg = f" Product \ "{ product_name } \ " does not exist"
938
+ msg = f' Product "{ product_name } " does not exist'
939
939
raise serializers .ValidationError (msg )
940
940
941
941
if engagement_name and not engagement :
942
- msg = f" Engagement \ "{ engagement_name } \ " does not exist in Product \ "{ product_name } \" "
942
+ msg = f' Engagement "{ engagement_name } " does not exist in Product "{ product_name } "'
943
943
raise serializers .ValidationError (msg )
944
944
945
945
# these are only set for reimport
946
946
if test_title :
947
- msg = f" Test \ "{ test_title } \ " with scan_type \ "{ scan_type } \ " does not exist in Engagement \ "{ engagement_name } \" "
947
+ msg = f' Test "{ test_title } " with scan_type "{ scan_type } " does not exist in Engagement "{ engagement_name } "'
948
948
raise serializers .ValidationError (msg )
949
949
950
950
if scan_type :
951
- msg = f" Test with scan_type \ "{ scan_type } \ " does not exist in Engagement \ "{ engagement_name } \" "
951
+ msg = f' Test with scan_type "{ scan_type } " does not exist in Engagement "{ engagement_name } "'
952
952
raise serializers .ValidationError (msg )
953
953
954
954
raise ValidationError (error_message )
@@ -995,28 +995,28 @@ def check_auto_create_permission(
995
995
996
996
if product and product_name and engagement_name :
997
997
if not user_has_permission (user , product , Permissions .Engagement_Add ):
998
- msg = f" No permission to create engagements in product \ "{ product_name } \" "
998
+ msg = f' No permission to create engagements in product "{ product_name } "'
999
999
raise PermissionDenied (msg )
1000
1000
1001
1001
if not user_has_permission (
1002
1002
user , product , Permissions .Import_Scan_Result
1003
1003
):
1004
- msg = f" No permission to import scans into product \ "{ product_name } \" "
1004
+ msg = f' No permission to import scans into product "{ product_name } "'
1005
1005
raise PermissionDenied (msg )
1006
1006
1007
1007
# all good
1008
1008
return True
1009
1009
1010
1010
if not product and product_name :
1011
1011
if not product_type_name :
1012
- msg = f" Product \ "{ product_name } \ " does not exist and no product_type_name provided to create the new product in"
1012
+ msg = f' Product "{ product_name } " does not exist and no product_type_name provided to create the new product in'
1013
1013
raise serializers .ValidationError (msg )
1014
1014
1015
1015
if not product_type :
1016
1016
if not user_has_global_permission (
1017
1017
user , Permissions .Product_Type_Add
1018
1018
):
1019
- msg = f" No permission to create product_type \ "{ product_type_name } \" "
1019
+ msg = f' No permission to create product_type "{ product_type_name } "'
1020
1020
raise PermissionDenied (msg )
1021
1021
# new product type can be created with current user as owner, so
1022
1022
# all objects in it can be created as well
@@ -1025,7 +1025,7 @@ def check_auto_create_permission(
1025
1025
if not user_has_permission (
1026
1026
user , product_type , Permissions .Product_Type_Add_Product
1027
1027
):
1028
- msg = f" No permission to create products in product_type \ "{ product_type } \" "
1028
+ msg = f' No permission to create products in product_type "{ product_type } "'
1029
1029
raise PermissionDenied (msg )
1030
1030
1031
1031
# product can be created, so objects in it can be created as well
0 commit comments