@@ -208,7 +208,7 @@ def __init__(self, **kwargs):
208208 self .pretty_print = pretty_print
209209
210210 def to_internal_value (self , data ):
211- logger .debug (f"to_internal_value called with data: { data } " )
211+ # logger.debug(f"to_internal_value called with data: {data}")
212212 # logger.debug("Stacktrace:\n%s", "".join(traceback.format_stack()))
213213 if isinstance (data , list ) and data == ["" ] and self .allow_empty :
214214 return []
@@ -239,15 +239,11 @@ def to_internal_value(self, data):
239239 tag_validator (sub , exception_class = RestFrameworkValidationError )
240240 data_safe .extend (substrings )
241241
242- logger .debug (f"data_safe after processing: { data_safe } " )
243- # result = tagulous.utils.render_tags(data_safe)
244242 logger .debug (f"result after rendering tags: { data_safe } " )
245243 return data_safe
246- # logger.debug(f"result after rendering tags: {result}")
247- # return result
248244
249245 def to_representation (self , value ):
250- logger .debug (f"to_representation called with value: { value } " )
246+ # logger.debug(f"to_representation called with value: {value}")
251247 if not isinstance (value , list ):
252248 # we can't use isinstance because TagRelatedManager is non-existing class
253249 # it cannot be imported or referenced, so we fallback to string
@@ -1741,12 +1737,7 @@ def process_risk_acceptance(self, data):
17411737
17421738 # Overriding this to push add Push to JIRA functionality
17431739 def update (self , instance , validated_data ):
1744- # remove tags from validated data and store them seperately
1745- # to_be_tagged, validated_data = self._pop_tags(validated_data)
1746-
1747- # pop push_to_jira so it won't get send to the model as a field
1748- # TODO: JIRA can we remove this is_push_all_issues, already checked in
1749- # apiv2 viewset?
1740+ # push_all_issues already checked in api views.py
17501741 push_to_jira = validated_data .pop ("push_to_jira" )
17511742
17521743 # Save vulnerability ids and pop them
@@ -1764,17 +1755,9 @@ def update(self, instance, validated_data):
17641755 instance , validated_data ,
17651756 )
17661757
1767- # If we need to push to JIRA, an extra save call is needed.
1768- # Also if we need to update the mitigation date of the finding.
1769- # TODO: try to combine create and save, but for now I'm just fixing a
1770- # bug and don't want to change to much
17711758 if push_to_jira :
1772- logger .debug (f"Pushing updated finding { instance .id } to JIRA" )
17731759 jira_helper .push_to_jira (instance )
17741760
1775- # not sure why we are returning a tag_object, but don't want to change
1776- # too much now as we're just fixing a bug
1777- # return self._save_tags(instance, to_be_tagged)
17781761 return instance
17791762
17801763 def validate (self , data ):
@@ -1878,8 +1861,6 @@ class Meta:
18781861
18791862 # Overriding this to push add Push to JIRA functionality
18801863 def create (self , validated_data ):
1881- # Pop off of some fields that should not be sent to the model at this time
1882- # to_be_tagged, validated_data = self._pop_tags(validated_data)
18831864 logger .debug (f"Creating finding with validated data: { validated_data } " )
18841865 push_to_jira = validated_data .pop ("push_to_jira" , False )
18851866 notes = validated_data .pop ("notes" , None )
@@ -1894,8 +1875,6 @@ def create(self, validated_data):
18941875 new_finding = super ().create (
18951876 validated_data )
18961877
1897- # Create a findings in memory so that we have access to unsaved_vulnerability_ids
1898- # new_finding = Finding(**validated_data)
18991878 new_finding .unsaved_vulnerability_ids = parsed_vulnerability_ids
19001879
19011880 # Deal with all of the many to many things
@@ -1908,13 +1887,9 @@ def create(self, validated_data):
19081887 if parsed_vulnerability_ids :
19091888 save_vulnerability_ids (new_finding , parsed_vulnerability_ids )
19101889
1911- # If we need to push to JIRA, an extra save call is needed.
1912- # TODO: try to combine create and save, but for now I'm just fixing a
1913- # bug and don't want to change to much
19141890 if push_to_jira :
19151891 jira_helper .push_to_jira (new_finding )
1916- # This final call will save the finding again and return it
1917- # return self._save_tags(new_finding, to_be_tagged)
1892+
19181893 return new_finding
19191894
19201895 def validate (self , data ):
0 commit comments