Merge branch 'develop' into python-distributed-testing
This commit is contained in:
commit
cb6f263001
4 changed files with 31 additions and 5 deletions
|
|
@ -54,7 +54,8 @@
|
|||
"fieldname": "client_id",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Client Id"
|
||||
"label": "Client Id",
|
||||
"mandatory_depends_on": "eval:doc.redirect_uri"
|
||||
},
|
||||
{
|
||||
"fieldname": "redirect_uri",
|
||||
|
|
@ -96,12 +97,14 @@
|
|||
{
|
||||
"fieldname": "authorization_uri",
|
||||
"fieldtype": "Data",
|
||||
"label": "Authorization URI"
|
||||
"label": "Authorization URI",
|
||||
"mandatory_depends_on": "eval:doc.redirect_uri"
|
||||
},
|
||||
{
|
||||
"fieldname": "token_uri",
|
||||
"fieldtype": "Data",
|
||||
"label": "Token URI"
|
||||
"label": "Token URI",
|
||||
"mandatory_depends_on": "eval:doc.redirect_uri"
|
||||
},
|
||||
{
|
||||
"fieldname": "revocation_uri",
|
||||
|
|
@ -136,7 +139,7 @@
|
|||
"link_fieldname": "connected_app"
|
||||
}
|
||||
],
|
||||
"modified": "2020-11-16 16:29:50.277405",
|
||||
"modified": "2021-05-10 05:03:06.296863",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Integrations",
|
||||
"name": "Connected App",
|
||||
|
|
|
|||
|
|
@ -26,20 +26,27 @@ class ConnectedApp(Document):
|
|||
self.redirect_uri = urljoin(base_url, callback_path)
|
||||
|
||||
def get_oauth2_session(self, user=None, init=False):
|
||||
"""Return an auto-refreshing OAuth2 session which is an extension of a requests.Session()"""
|
||||
token = None
|
||||
token_updater = None
|
||||
auto_refresh_kwargs = None
|
||||
|
||||
if not init:
|
||||
user = user or frappe.session.user
|
||||
token_cache = self.get_user_token(user)
|
||||
token = token_cache.get_json()
|
||||
token_updater = token_cache.update_data
|
||||
auto_refresh_kwargs = {'client_id': self.client_id}
|
||||
client_secret = self.get_password('client_secret')
|
||||
if client_secret:
|
||||
auto_refresh_kwargs['client_secret'] = client_secret
|
||||
|
||||
return OAuth2Session(
|
||||
client_id=self.client_id,
|
||||
token=token,
|
||||
token_updater=token_updater,
|
||||
auto_refresh_url=self.token_uri,
|
||||
auto_refresh_kwargs=auto_refresh_kwargs,
|
||||
redirect_uri=self.redirect_uri,
|
||||
scope=self.get_scopes()
|
||||
)
|
||||
|
|
|
|||
|
|
@ -13,9 +13,11 @@ frappe.ui.form.ControlDate = frappe.ui.form.ControlData.extend({
|
|||
this._super(value);
|
||||
if (this.timepicker_only) return;
|
||||
if (!this.datepicker) return;
|
||||
if(!value) {
|
||||
if (!value) {
|
||||
this.datepicker.clear();
|
||||
return;
|
||||
} else if (value === "Today") {
|
||||
value = this.get_now_date();
|
||||
}
|
||||
|
||||
let should_refresh = this.last_value && this.last_value !== value;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ from shutil import rmtree
|
|||
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe.website.render import clear_cache
|
||||
from frappe import _
|
||||
from frappe.modules.export_file import (
|
||||
write_document_file,
|
||||
|
|
@ -37,6 +38,19 @@ class WebTemplate(Document):
|
|||
if was_standard and not self.standard:
|
||||
self.import_from_files()
|
||||
|
||||
def on_update(self):
|
||||
"""Clear cache for all Web Pages in which this template is used"""
|
||||
routes = frappe.db.get_all(
|
||||
"Web Page",
|
||||
filters=[
|
||||
["Web Page Block", "web_template", "=", self.name],
|
||||
["Web Page", "published", "=", 1],
|
||||
],
|
||||
pluck="route",
|
||||
)
|
||||
for route in routes:
|
||||
clear_cache(route)
|
||||
|
||||
def on_trash(self):
|
||||
if frappe.conf.developer_mode and self.standard:
|
||||
# delete template html and json files
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue