Browse Source

[fix] bench new-site

version-14
Rushabh Mehta 9 years ago
parent
commit
7824f39409
2 changed files with 4 additions and 3 deletions
  1. +3
    -2
      frappe/__init__.py
  2. +1
    -1
      frappe/commands.py

+ 3
- 2
frappe/__init__.py View File

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

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`"""
if getattr(local, "initialised", None):
return
@@ -108,6 +108,7 @@ def init(site, sites_path=None):
"ignore_links": False,
"mute_emails": False,
"has_dataurl": False,
"new_site": new_site
})
local.rollback_observers = []
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")
if os.path.exists(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)

return _dict(config)


+ 1
- 1
frappe/commands.py View File

@@ -65,7 +65,7 @@ def new_site(site, mariadb_root_username=None, mariadb_root_password=None, admin
if not db_name:
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)
if len(frappe.utils.get_sites()) == 1:
use(site)


Loading…
Cancel
Save