From 2149283fd1ec45e26cbb0f7b0c97fca987487e36 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Mon, 1 Jun 2020 12:43:41 +0530 Subject: [PATCH] fix: raise SitNotSpecifiedError via get_site --- frappe/commands/__init__.py | 2 +- frappe/commands/utils.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frappe/commands/__init__.py b/frappe/commands/__init__.py index 832a7eb415..42f4440547 100644 --- a/frappe/commands/__init__.py +++ b/frappe/commands/__init__.py @@ -48,7 +48,7 @@ def get_site(context): site = context.sites[0] return site except (IndexError, TypeError): - sys.exit(1) + raise frappe.SiteNotSpecifiedError def popen(command, *args, **kwargs): output = kwargs.get('output', True) diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py index 869178ff3c..9bed7eb472 100644 --- a/frappe/commands/utils.py +++ b/frappe/commands/utils.py @@ -385,6 +385,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.