瀏覽代碼

fix: redo improper merge commit

version-14
Gavin D'souza 5 年之前
父節點
當前提交
9d11f2c44f
共有 8 個檔案被更改,包括 28 行新增13 行删除
  1. +1
    -2
      frappe/__init__.py
  2. +6
    -3
      frappe/commands/__init__.py
  3. +1
    -0
      frappe/commands/scheduler.py
  4. +2
    -1
      frappe/commands/site.py
  5. +1
    -0
      frappe/commands/translate.py
  6. +3
    -0
      frappe/commands/utils.py
  7. +5
    -0
      frappe/exceptions.py
  8. +9
    -7
      frappe/utils/bench_helper.py

+ 1
- 2
frappe/__init__.py 查看文件

@@ -231,9 +231,8 @@ def get_site_config(sites_path=None, site_path=None):
if os.path.exists(site_config):
config.update(get_file_json(site_config))
elif local.site and not local.flags.new_site:
print("{0} does not exist".format(local.site))
print("Site {0} does not exist".format(local.site))
sys.exit(1)
#raise IncorrectSitePath, "{0} does not exist".format(site_config)

return _dict(config)



+ 6
- 3
frappe/commands/__init__.py 查看文件

@@ -22,7 +22,11 @@ def pass_context(f):
pr = cProfile.Profile()
pr.enable()

ret = f(frappe._dict(ctx.obj), *args, **kwargs)
try:
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
except frappe.exceptions.SiteNotSpecifiedError as e:
click.secho(str(e), fg='yellow')
sys.exit(1)

if profile:
pr.disable()
@@ -44,8 +48,7 @@ def get_site(context):
site = context.sites[0]
return site
except (IndexError, TypeError):
print('Please specify --site sitename')
sys.exit(1)
raise frappe.SiteNotSpecifiedError

def popen(command, *args, **kwargs):
output = kwargs.get('output', True)


+ 1
- 0
frappe/commands/scheduler.py 查看文件

@@ -4,6 +4,7 @@ import sys
import frappe
from frappe.utils import cint
from frappe.commands import pass_context, get_site
from frappe.exceptions import SiteNotSpecifiedError

def _is_scheduler_enabled():
enable_scheduler = False


+ 2
- 1
frappe/commands/site.py 查看文件

@@ -15,6 +15,7 @@ import frappe
from frappe import _
from frappe.commands import get_site, pass_context
from frappe.commands.scheduler import _is_scheduler_enabled
from frappe.exceptions import SiteNotSpecifiedError
from frappe.installer import update_site_config
from frappe.utils import get_site_path, touch_file

@@ -368,7 +369,7 @@ def use(site, sites_path='.'):
sitefile.write(site)
print("Current Site set to {}".format(site))
else:
print("{} does not exist".format(site))
print("Site {} does not exist".format(site))

@click.command('backup')
@click.option('--with-files', default=False, is_flag=True, help="Take backup with files")


+ 1
- 0
frappe/commands/translate.py 查看文件

@@ -1,6 +1,7 @@
from __future__ import unicode_literals, absolute_import, print_function
import click
from frappe.commands import pass_context, get_site
from frappe.exceptions import SiteNotSpecifiedError

# translation
@click.command('build-message-files')


+ 3
- 0
frappe/commands/utils.py 查看文件

@@ -6,6 +6,7 @@ import json, os, sys, subprocess
from distutils.spawn import find_executable
import frappe
from frappe.commands import pass_context, get_site
from frappe.exceptions import SiteNotSpecifiedError
from frappe.utils import update_progress_bar, get_bench_path
from frappe.utils.response import json_handler
from coverage import Coverage
@@ -376,6 +377,8 @@ def mariadb(context):
import os

site = get_site(context)
if not site:
raise SiteNotSpecifiedError
frappe.init(site=site)

# This is assuming you're within the bench instance.


+ 5
- 0
frappe/exceptions.py 查看文件

@@ -13,6 +13,11 @@ if sys.version_info.major == 2:
else:
from builtins import FileNotFoundError

class SiteNotSpecifiedError(Exception):
def __init__(self, *args, **kwargs):
self.message = "Please specify --site sitename"
super(Exception, self).__init__(self.message)

class ValidationError(Exception):
http_status_code = 417



+ 9
- 7
frappe/utils/bench_helper.py 查看文件

@@ -50,14 +50,16 @@ def app_group(ctx, site=False, force=False, verbose=False, profile=False):
ctx.info_name = ''

def get_sites(site_arg):
if site_arg and site_arg == 'all':
if site_arg == 'all':
return frappe.utils.get_sites()
else:
if site_arg:
return [site_arg]
if os.path.exists('currentsite.txt'):
with open('currentsite.txt') as f:
return [f.read().strip()]
elif site_arg:
return [site_arg]
elif os.path.exists('currentsite.txt'):
with open('currentsite.txt') as f:
site = f.read().strip()
if site:
return [site]
return []

def get_app_commands(app):
if os.path.exists(os.path.join('..', 'apps', app, app, 'commands.py'))\


Loading…
取消
儲存