Commit 0edaa074 authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

response are not replaced anymore

parent c7a1a656
......@@ -74,7 +74,7 @@ class ImportationObserver:
DUPLICATED = 1
EMPTY_NAME = 2
def notify_response_error(self, virus, host, response_str, replaced):
def notify_response_error(self, virus, host, response_str):
pass
def notify_host_error(self, host, column_id, reason=None, reason_id=None):
......@@ -103,17 +103,15 @@ class MessageImportationObserver(ImportationObserver):
def add_message(self, request, level, message):
messages.add_message(request=request, level=level, message=message)
def notify_response_error(self, virus, host, response_str, replaced):
def notify_response_error(self, virus, host, response_str):
self.add_message(
self.request,
messages.WARNING,
"[ImportErr2] " + gettext(
"Could not import response \"%(response)s\" for virus \"%(virus)s\", host\"%(host)s\", "
"replacing it with \"%(rpl)s\"") % dict(
"Could not import response \"%(response)s\" for virus \"%(virus)s\", host\"%(host)s\"") % dict(
response=str(response_str),
virus=str(virus),
host=str(host),
rpl=str(replaced),
)
)
......@@ -182,18 +180,6 @@ class StackErrorImportationObserver(MessageImportationObserver):
def add_message(self, request, level, message):
self.errors.append(message)
def notify_response_error(self, virus, host, response_str, replaced):
self.add_message(
self.request,
messages.WARNING,
"[ImportErr2] " + gettext(
"Could not import response \"%(response)s\" for virus \"%(virus)s\", host\"%(host)s\"") % dict(
response=str(response_str),
virus=str(virus),
host=str(host),
)
)
def panda_color_mapping(v):
key = 'html_color_%s' % str(v)
......@@ -405,7 +391,7 @@ def __parse_file(file, importation_observer: ImportationObserver = None, sheet_n
except ValueError:
parsed_response = -1000
if importation_observer:
importation_observer.notify_response_error(virus, host, cell, parsed_response)
importation_observer.notify_response_error(virus, host, cell)
yield ViralHostResponse(
virus=virus,
virus_identifiers=virus_identifiers,
......@@ -644,7 +630,7 @@ def __import_file(*, data_source, parsed_file, importation_observer: Importation
float(vhr.response)
except ValueError as e:
if importation_observer:
importation_observer.notify_response_error(vhr.virus, vhr.host, vhr.response, vhr.parsed_response)
importation_observer.notify_response_error(vhr.virus, vhr.host, vhr.response)
else:
raise e
# update or create response in db
......
......@@ -27,7 +27,7 @@ class NoErrorImportationObserver(business_process.MessageImportationObserver):
class Meta:
abstract = True
def notify_response_error(self, virus, host, response_str, replaced):
def notify_response_error(self, virus, host, response_str):
raise ResponseException(
"[ImportErr2] " +
"Could not import response \"%(response)s\" for virus \"%(virus)s\", host\"%(host)s\", "
......@@ -35,7 +35,6 @@ class NoErrorImportationObserver(business_process.MessageImportationObserver):
response=str(response_str),
virus=str(virus),
host=str(host),
rpl=str(replaced),
)
)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment