From f427f18af1e72b79a34b092dd2a3c55dfecfcb7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Mon, 24 Oct 2022 17:01:37 -0300 Subject: [PATCH] Aprimora crowler uso dos produtos --- sigi/apps/servicos/models.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sigi/apps/servicos/models.py b/sigi/apps/servicos/models.py index ab53226..2925375 100644 --- a/sigi/apps/servicos/models.py +++ b/sigi/apps/servicos/models.py @@ -210,7 +210,17 @@ class Servico(models.Model): data = data[c] if param_pesquisa[1] == "xml": - data = data.firstChild.nodeValue + if data.hasChildNodes(): + data = data.firstChild.nodeValue + else: + data = data.nodeValue + if data is None or data == "": + return { + "data": "", + "resultado": "U", + "erro": _("Sem data da última atualização."), + "comment": _("Parece que nunca foi usado"), + } data = data[:10] data = data.replace("/", "-") return {