From 231d90cb40eda39543a55ea6a5fd588bdc5fa514 Mon Sep 17 00:00:00 2001 From: phot0n Date: Thu, 29 Dec 2022 17:26:08 +0530 Subject: [PATCH] chore: handle get requests via frappe.whitelist decorator --- frappe/email/doctype/email_account/email_account.py | 1 - frappe/email/oauth.py | 2 +- frappe/integrations/doctype/connected_app/connected_app.py | 4 +--- frappe/translations/ru.csv | 1 - frappe/website/doctype/blog_post/templates/blog_post.html | 2 +- 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index 3ad2f67c0b..a0fc8f162e 100755 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -16,7 +16,6 @@ from frappe.email.doctype.email_domain.email_domain import EMAIL_DOMAIN_FIELDS from frappe.email.receive import EmailServer, InboundMail, SentEmailInInboxError from frappe.email.smtp import SMTPServer from frappe.email.utils import get_port -from frappe.integrations.doctype.connected_app.connected_app import check_active_token from frappe.model.document import Document from frappe.utils import cint, comma_or, cstr, parse_addr, validate_email_address from frappe.utils.background_jobs import enqueue, get_jobs diff --git a/frappe/email/oauth.py b/frappe/email/oauth.py index c69ab2211e..ad951d770e 100644 --- a/frappe/email/oauth.py +++ b/frappe/email/oauth.py @@ -61,7 +61,7 @@ class Oauth: # where the connect method is called from - hence just logging and raising. raise - def _connect_pop(self) -> bytes: + def _connect_pop(self) -> None: # poplib doesn't have AUTH command implementation res = self._conn._shortcmd( "AUTH {} {}".format( diff --git a/frappe/integrations/doctype/connected_app/connected_app.py b/frappe/integrations/doctype/connected_app/connected_app.py index cd219263e9..e8193c89f2 100644 --- a/frappe/integrations/doctype/connected_app/connected_app.py +++ b/frappe/integrations/doctype/connected_app/connected_app.py @@ -117,7 +117,7 @@ class ConnectedApp(Document): return token_cache -@frappe.whitelist(allow_guest=True) +@frappe.whitelist(methods=["GET"], allow_guest=True) def callback(code=None, state=None): """Handle client's code. @@ -125,8 +125,6 @@ def callback(code=None, state=None): transmit a code that can be used by the local server to obtain an access token. """ - if frappe.request.method != "GET": - frappe.throw(_("Invalid request method: {}").format(frappe.request.method)) if frappe.session.user == "Guest": frappe.local.response["type"] = "redirect" diff --git a/frappe/translations/ru.csv b/frappe/translations/ru.csv index 1c99690ff3..f83bf411ff 100644 --- a/frappe/translations/ru.csv +++ b/frappe/translations/ru.csv @@ -6,7 +6,6 @@ Account,Аккаунт, Accounts Manager,Диспетчер учетных записей, Accounts User,Пользователь Учетных записей, Action,Действие, -min read, Действие, Actions,Действия, Active,Активен, Add,Добавить, diff --git a/frappe/website/doctype/blog_post/templates/blog_post.html b/frappe/website/doctype/blog_post/templates/blog_post.html index 708b896357..67236fb26d 100644 --- a/frappe/website/doctype/blog_post/templates/blog_post.html +++ b/frappe/website/doctype/blog_post/templates/blog_post.html @@ -22,7 +22,7 @@ {%- if read_time -%}  · - {{ read_time }} {{ _("min read") }} + {{ read_time }} min read {%- endif -%}