Merge branch 'develop' into filter-with-content-value
This commit is contained in:
commit
2d3efd34bd
4 changed files with 15 additions and 14 deletions
|
|
@ -453,16 +453,17 @@ def evaluate_alert(doc: Document, alert, event):
|
|||
doc.reload()
|
||||
alert.send(doc)
|
||||
except TemplateError:
|
||||
frappe.throw(
|
||||
_("Error while evaluating Notification {0}. Please fix your template.").format(alert)
|
||||
message = _("Error while evaluating Notification {0}. Please fix your template.").format(
|
||||
frappe.utils.get_link_to_form("Notification", alert.name)
|
||||
)
|
||||
frappe.throw(message, title=_("Error in Notification"))
|
||||
except Exception as e:
|
||||
error_log = frappe.log_error(message=frappe.get_traceback(), title=str(e))
|
||||
frappe.throw(
|
||||
_("Error in Notification: {}").format(
|
||||
frappe.utils.get_link_to_form("Error Log", error_log.name)
|
||||
)
|
||||
)
|
||||
title = str(e)
|
||||
message = frappe.get_traceback()
|
||||
frappe.log_error(message=message, title=title)
|
||||
|
||||
msg = f"<details><summary>{title}</summary>{message}</details>"
|
||||
frappe.throw(msg, title=_("Error in Notification"))
|
||||
|
||||
|
||||
def get_context(doc):
|
||||
|
|
|
|||
|
|
@ -222,9 +222,7 @@ class EmailServer:
|
|||
self.pop.dele(m)
|
||||
|
||||
except Exception as e:
|
||||
if self.has_login_limit_exceeded(e):
|
||||
pass
|
||||
else:
|
||||
if not self.has_login_limit_exceeded(e):
|
||||
raise
|
||||
|
||||
out = {"latest_messages": self.latest_messages}
|
||||
|
|
@ -368,7 +366,7 @@ class EmailServer:
|
|||
self.seen_status.update({uid: "UNSEEN"})
|
||||
|
||||
def has_login_limit_exceeded(self, e):
|
||||
return "-ERR Exceeded the login limit" in strip(cstr(e.message))
|
||||
return "-ERR Exceeded the login limit" in strip(cstr(e))
|
||||
|
||||
def is_temporary_system_problem(self, e):
|
||||
messages = (
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import pytz
|
|||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import cint, cstr
|
||||
from frappe.utils import cint, cstr, get_time_zone
|
||||
|
||||
|
||||
class TokenCache(Document):
|
||||
|
|
@ -52,7 +52,9 @@ class TokenCache(Document):
|
|||
return self
|
||||
|
||||
def get_expires_in(self):
|
||||
system_timezone = pytz.timezone(get_time_zone())
|
||||
modified = frappe.utils.get_datetime(self.modified)
|
||||
modified = system_timezone.localize(modified)
|
||||
expiry_utc = modified.astimezone(pytz.utc) + timedelta(seconds=self.expires_in)
|
||||
now_utc = datetime.utcnow().replace(tzinfo=pytz.utc)
|
||||
return cint((expiry_utc - now_utc).total_seconds())
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ def log_request(
|
|||
"url": url,
|
||||
"headers": frappe.as_json(headers) if headers else None,
|
||||
"data": frappe.as_json(data) if data else None,
|
||||
"response": frappe.as_json(res.json()) if res else None,
|
||||
"response": res and res.text,
|
||||
"error": frappe.get_traceback(),
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue