bench use <site> should check if the site exists (#5849)

* bench use <site> should check if the  site exists

* check site path while running use site
This commit is contained in:
Shridhar Patil 2018-07-23 14:35:17 +05:30 committed by Rushabh Mehta
parent 191684f6a5
commit 630858eb96

View file

@ -277,8 +277,11 @@ def _use(site, sites_path='.'):
use(site, sites_path=sites_path)
def use(site, sites_path='.'):
with open(os.path.join(sites_path, "currentsite.txt"), "w") as sitefile:
sitefile.write(site)
if os.path.exists(os.path.join(sites_path, site)):
with open(os.path.join(sites_path, "currentsite.txt"), "w") as sitefile:
sitefile.write(site)
else:
print("{} does not exist".format(site))
@click.command('backup')
@click.option('--with-files', default=False, is_flag=True, help="Take backup with files")