瀏覽代碼

[fix] bench new-site

version-14
Rushabh Mehta 9 年之前
父節點
當前提交
7824f39409
共有 2 個文件被更改,包括 4 次插入3 次删除
  1. +3
    -2
      frappe/__init__.py
  2. +1
    -1
      frappe/commands.py

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

@@ -85,7 +85,7 @@ message_log = local("message_log")


lang = local("lang") lang = local("lang")


def init(site, sites_path=None):
def init(site, sites_path=None, new_site=False):
"""Initialize frappe for the current site. Reset thread locals `frappe.local`""" """Initialize frappe for the current site. Reset thread locals `frappe.local`"""
if getattr(local, "initialised", None): if getattr(local, "initialised", None):
return return
@@ -108,6 +108,7 @@ def init(site, sites_path=None):
"ignore_links": False, "ignore_links": False,
"mute_emails": False, "mute_emails": False,
"has_dataurl": False, "has_dataurl": False,
"new_site": new_site
}) })
local.rollback_observers = [] local.rollback_observers = []
local.test_objects = {} local.test_objects = {}
@@ -173,7 +174,7 @@ def get_site_config(sites_path=None, site_path=None):
site_config = os.path.join(site_path, "site_config.json") site_config = os.path.join(site_path, "site_config.json")
if os.path.exists(site_config): if os.path.exists(site_config):
config.update(get_file_json(site_config)) config.update(get_file_json(site_config))
elif local.site:
elif local.site and not local.flags.new_site:
raise IncorrectSitePath, "{0} does not exist".format(site_config) raise IncorrectSitePath, "{0} does not exist".format(site_config)


return _dict(config) return _dict(config)


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

@@ -65,7 +65,7 @@ def new_site(site, mariadb_root_username=None, mariadb_root_password=None, admin
if not db_name: if not db_name:
db_name = hashlib.sha1(site).hexdigest()[:10] db_name = hashlib.sha1(site).hexdigest()[:10]


frappe.init(site=site)
frappe.init(site=site, new_site=True)
_new_site(db_name, site, mariadb_root_username=mariadb_root_username, mariadb_root_password=mariadb_root_password, admin_password=admin_password, verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force) _new_site(db_name, site, mariadb_root_username=mariadb_root_username, mariadb_root_password=mariadb_root_password, admin_password=admin_password, verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)
if len(frappe.utils.get_sites()) == 1: if len(frappe.utils.get_sites()) == 1:
use(site) use(site)


Loading…
取消
儲存