Raise Forbidden if backup download is not allowed, verbose is default in cli.py
This commit is contained in:
parent
39f0aa17d1
commit
1b496fa712
4 changed files with 11 additions and 15 deletions
|
|
@ -12,9 +12,9 @@ install:
|
|||
|
||||
script:
|
||||
cd ./test_sites/ &&
|
||||
frappe --reinstall -v test_site &&
|
||||
frappe -b -v test_site &&
|
||||
frappe --run_tests -v test_site
|
||||
frappe --reinstall test_site &&
|
||||
frappe -b test_site &&
|
||||
frappe --run_tests test_site
|
||||
|
||||
before_script:
|
||||
- mysql -e 'create database travis' &&
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ def setup_parser():
|
|||
# common
|
||||
parser.add_argument("-f", "--force", default=False, action="store_true",
|
||||
help="Force execution where applicable (look for [-f] in help)")
|
||||
parser.add_argument("-v", "--verbose", default=False, action="store_true", dest="verbose",
|
||||
help="Show verbose output where applicable")
|
||||
parser.add_argument("--quiet", default=True, action="store_false", dest="verbose",
|
||||
help="Do not show verbose output (where applicable)")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# MIT License. See license.txt
|
||||
|
||||
"""This module handles the On Demand Backup utility"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
"""
|
||||
This module handles the On Demand Backup utility
|
||||
|
||||
To setup in defs set:
|
||||
backup_path: path where backups will be taken (for eg /backups)
|
||||
backup_link_path: download link for backups (eg /var/www/frappe/backups)
|
||||
backup_url: base url of the backup folder (eg http://mysite.com/backups)
|
||||
"""
|
||||
|
||||
#Imports
|
||||
import os, frappe
|
||||
from datetime import datetime
|
||||
|
|
|
|||
|
|
@ -8,13 +8,14 @@ import gzip, cStringIO
|
|||
import mimetypes
|
||||
import os
|
||||
import frappe
|
||||
from frappe import _
|
||||
import frappe.utils
|
||||
import frappe.sessions
|
||||
import frappe.model.utils
|
||||
from werkzeug.local import LocalProxy
|
||||
from werkzeug.wsgi import wrap_file
|
||||
from werkzeug.wrappers import Response
|
||||
from werkzeug.exceptions import NotFound, Unauthorized
|
||||
from werkzeug.exceptions import NotFound, Forbidden
|
||||
|
||||
def report_error(status_code):
|
||||
if status_code!=404 or frappe.conf.logging:
|
||||
|
|
@ -123,7 +124,7 @@ def download_backup(path):
|
|||
try:
|
||||
frappe.only_for(("System Manager", "Administrator"))
|
||||
except frappe.PermissionError:
|
||||
raise Unauthorized
|
||||
raise Forbidden(_("You need to be logged in and have System Manager Role to be able to access backups."))
|
||||
send_private_file(path)
|
||||
|
||||
def send_private_file(path):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue