소스 검색

Merge branch 'hotfix'

version-14
Nabin Hait 8 년 전
부모
커밋
7dbe38e37a
5개의 변경된 파일74개의 추가작업 그리고 16개의 파일을 삭제
  1. +1
    -1
      frappe/__init__.py
  2. +3
    -1
      frappe/integration_broker/doctype/integration_service/integration_service.js
  3. +5
    -5
      frappe/integrations/doctype/dropbox_settings/dropbox_settings.js
  4. +48
    -3
      frappe/integrations/doctype/dropbox_settings/dropbox_settings.json
  5. +17
    -6
      frappe/integrations/doctype/dropbox_settings/dropbox_settings.py

+ 1
- 1
frappe/__init__.py 파일 보기

@@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json
from .exceptions import * from .exceptions import *
from .utils.jinja import get_jenv, get_template, render_template from .utils.jinja import get_jenv, get_template, render_template


__version__ = '7.1.26'
__version__ = '7.1.27'
__title__ = "Frappe Framework" __title__ = "Frappe Framework"


local = Local() local = Local()


+ 3
- 1
frappe/integration_broker/doctype/integration_service/integration_service.js 파일 보기

@@ -31,10 +31,12 @@ frappe.ui.form.on('Integration Service', {
}, },
setup_custom_buttons: function(frm) { setup_custom_buttons: function(frm) {
frm.clear_custom_buttons();

frm.add_custom_button(__("{0} Settings", [frm.doc.service]), function(){ frm.add_custom_button(__("{0} Settings", [frm.doc.service]), function(){
frappe.set_route("List", frm.doc.service + " Settings"); frappe.set_route("List", frm.doc.service + " Settings");
}); });
frm.add_custom_button(__("Show Log"), function(){ frm.add_custom_button(__("Show Log"), function(){
frappe.route_options = {"integration_request_service": frm.doc.service}; frappe.route_options = {"integration_request_service": frm.doc.service};
frappe.set_route("List", "Integration Request"); frappe.set_route("List", "Integration Request");


+ 5
- 5
frappe/integrations/doctype/dropbox_settings/dropbox_settings.js 파일 보기

@@ -8,9 +8,9 @@ frappe.ui.form.on('Dropbox Settings', {
frm.clear_custom_buttons(); frm.clear_custom_buttons();
frm.events.take_backup(frm); frm.events.take_backup(frm);
}, },
allow_dropbox_access: function(frm) { allow_dropbox_access: function(frm) {
if (frm.doc.app_access_key && frm.doc.app_secret_key) {
if ((frm.doc.app_access_key && frm.doc.app_secret_key) || frm.doc.dropbox_setup_via_site_config) {
frappe.call({ frappe.call({
method: "frappe.integrations.doctype.dropbox_settings.dropbox_settings.get_dropbox_authorize_url", method: "frappe.integrations.doctype.dropbox_settings.dropbox_settings.get_dropbox_authorize_url",
freeze: true, freeze: true,
@@ -41,16 +41,16 @@ frappe.ui.form.on('Dropbox Settings', {


frappe.integration_service.dropbox_settings = Class.extend({ frappe.integration_service.dropbox_settings = Class.extend({
init: function(frm) { init: function(frm) {
}, },
get_scheduler_job_info: function() { get_scheduler_job_info: function() {
return { return {
"Daily": "Take backup of database and files to dropbox on daily basis", "Daily": "Take backup of database and files to dropbox on daily basis",
"Weekly": "Take backup of database and files to dropbox on weekly basis" "Weekly": "Take backup of database and files to dropbox on weekly basis"
} }
}, },
get_service_info: function(frm) { get_service_info: function(frm) {
frappe.call({ frappe.call({
method: "frappe.integrations.doctype.dropbox_settings.dropbox_settings.get_service_details", method: "frappe.integrations.doctype.dropbox_settings.dropbox_settings.get_service_details",


+ 48
- 3
frappe/integrations/doctype/dropbox_settings/dropbox_settings.json 파일 보기

@@ -22,6 +22,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Send Notifications To", "label": "Send Notifications To",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@@ -30,6 +31,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
"search_index": 0, "search_index": 0,
@@ -48,6 +50,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Backup Frequency", "label": "Backup Frequency",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@@ -57,6 +60,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
"search_index": 0, "search_index": 0,
@@ -68,6 +72,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "eval:!doc.dropbox_setup_via_site_config",
"fieldname": "app_access_key", "fieldname": "app_access_key",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
@@ -75,6 +80,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "App Access Key", "label": "App Access Key",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@@ -83,8 +89,9 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1,
"reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
@@ -94,6 +101,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "eval:!doc.dropbox_setup_via_site_config",
"fieldname": "app_secret_key", "fieldname": "app_secret_key",
"fieldtype": "Password", "fieldtype": "Password",
"hidden": 0, "hidden": 0,
@@ -101,6 +109,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "App Secret Key", "label": "App Secret Key",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@@ -109,8 +118,9 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1,
"reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
@@ -127,6 +137,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow Dropbox Access", "label": "Allow Dropbox Access",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@@ -135,6 +146,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@@ -153,6 +165,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Dropbox Access Key", "label": "Dropbox Access Key",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@@ -161,6 +174,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 1, "read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@@ -179,6 +193,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Dropbox Access Secret", "label": "Dropbox Access Secret",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@@ -187,6 +202,35 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 1, "read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "dropbox_setup_via_site_config",
"fieldtype": "Check",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Dropbox Setup via Site Config",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@@ -204,7 +248,7 @@
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-09-22 03:55:40.716643",
"modified": "2016-12-19 02:10:05.231510",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Integrations", "module": "Integrations",
"name": "Dropbox Settings", "name": "Dropbox Settings",
@@ -221,6 +265,7 @@
"export": 1, "export": 1,
"if_owner": 0, "if_owner": 0,
"import": 0, "import": 0,
"is_custom": 0,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,


+ 17
- 6
frappe/integrations/doctype/dropbox_settings/dropbox_settings.py 파일 보기

@@ -24,6 +24,10 @@ class DropboxSettings(IntegrationService):
] ]
} }


def onload(self):
if not self.app_access_key and frappe.conf.dropbox_access_key:
self.dropbox_setup_via_site_config = 1

def validate(self): def validate(self):
if not self.flags.ignore_mandatory: if not self.flags.ignore_mandatory:
self.validate_dropbox_credentails() self.validate_dropbox_credentails()
@@ -48,11 +52,14 @@ class DropboxSettings(IntegrationService):
except: except:
raise Exception(_("Please install dropbox python module")) raise Exception(_("Please install dropbox python module"))


if not (self.app_access_key or self.app_secret_key):
app_access_key = self.app_access_key or frappe.conf.dropbox_access_key
app_secret_key = self.get_password(fieldname="app_secret_key",
raise_exception=False) if self.app_secret_key else frappe.conf.dropbox_secret_key

if not (app_access_key or app_secret_key):
raise Exception(_("Please set Dropbox access keys in your site config")) raise Exception(_("Please set Dropbox access keys in your site config"))


sess = session.DropboxSession(self.app_access_key,
self.get_password(fieldname="app_secret_key", raise_exception=False), "app_folder")
sess = session.DropboxSession(app_access_key, app_secret_key, "app_folder")


return sess return sess


@@ -138,13 +145,17 @@ def dropbox_callback(oauth_token=None, not_approved=False):


frappe.db.commit() frappe.db.commit()
else: else:
frappe.respond_as_web_page(_("Dropbox Approval"), _("Illegal Access Token Please try again. <p>Please close this window.</p"),
close = '<p class="text-muted">' + _('Please close this window') + '</p>'
frappe.respond_as_web_page(_("Dropbox Setup"),
_("Illegal Access Token. Please try again") + close,
success=False, http_status_code=frappe.AuthenticationError.http_status_code) success=False, http_status_code=frappe.AuthenticationError.http_status_code)
else: else:
frappe.respond_as_web_page(_("Dropbox Approval"), _("Dropbox Access not approved. <p>Please close this window.</p"),
frappe.respond_as_web_page(_("Dropbox Setup"),
_("You did not apporve Dropbox Access.") + close,
success=False, http_status_code=frappe.AuthenticationError.http_status_code) success=False, http_status_code=frappe.AuthenticationError.http_status_code)


frappe.respond_as_web_page(_("Dropbox Approval"), _("Dropbox access allowed. <p>Please close this window.</p"),
frappe.respond_as_web_page(_("Dropbox Setup"),
_("Dropbox access is approved!") + close,
success=False, http_status_code=frappe.AuthenticationError.http_status_code) success=False, http_status_code=frappe.AuthenticationError.http_status_code)


# backup process # backup process


불러오는 중...
취소
저장