[minor] fallback for conf.py paths

This commit is contained in:
Anand Doshi 2013-09-26 18:11:39 +05:30
parent 627c1f9bd2
commit 3b75743738
4 changed files with 10 additions and 10 deletions

View file

@ -16,19 +16,19 @@ def make(site=None):
site_path = get_site_base_path() if site else get_base_path()
# setup standard folders
for param in ("public_path", "backup_path", "files_path"):
path = os.path.join(site_path, webnotes.conf.get(param))
for param in (("public_path", "public"), ("backup_path", "public/backups"), ("files_path", "public/files")):
path = os.path.join(site_path, webnotes.conf.get(param[0], param[1]))
if not os.path.exists(path):
os.mkdir(path)
# setup js and css folders
if not site:
for folder in ("js", "css"):
path = get_path(webnotes.conf.public_path, folder)
path = get_path(webnotes.conf.get("public_path", "public"), folder)
if not os.path.exists(path):
os.mkdir(path)
os.chdir(webnotes.conf.public_path)
os.chdir(webnotes.conf.get("public_path", "public"))
symlinks = [
["app", "../app/public"],
["lib", "../lib/public"],

View file

@ -70,7 +70,7 @@ class BackupGenerator:
self.backup_path_db = this_file_path
def zip_files(self):
files_path = webnotes.utils.get_site_path(conf.files_path)
files_path = webnotes.utils.get_site_path(conf.get("files_path", "public/files"))
cmd_string = """tar -cf %s %s""" % (self.backup_path_files, files_path)
err, out = webnotes.utils.execute_in_shell(cmd_string)
@ -186,7 +186,7 @@ def get_backup_path():
if not backup_path:
import os
# TODO Use get_site_base_path
backup_path = webnotes.utils.get_site_path(conf.backup_path)
backup_path = webnotes.utils.get_site_path(conf.get("backup_path", "public/backups"))
return backup_path
#-------------------------------------------------------------------------------

View file

@ -65,7 +65,7 @@ def get_uploaded_content():
def save_file(fname, content, dt, dn):
import filecmp
from webnotes.model.code import load_doctype_module
files_path = get_site_path(conf.public_path)
files_path = get_site_path(conf.get("public_path", "public"))
module = load_doctype_module(dt, webnotes.conn.get_value("DocType", dt, "module"))
if hasattr(module, "attachments_folder"):
@ -103,7 +103,7 @@ def save_file(fname, content, dt, dn):
f = webnotes.bean({
"doctype": "File Data",
"file_name": os.path.relpath(os.path.join(files_path, fname), get_site_path(conf.public_path)),
"file_name": os.path.relpath(os.path.join(files_path, fname), get_site_path(conf.get("public_path", "public"))),
"attached_to_doctype": dt,
"attached_to_name": dn,
"file_size": file_size
@ -184,7 +184,7 @@ def get_file(fname):
# read the file
import os
files_path = get_site_path(conf.files_path)
files_path = get_site_path(conf.get("files_path", "public/files"))
file_path = os.path.join(files_path, file_name)
if not os.path.exists(file_path):
# check in folders

2
wnf.py
View file

@ -365,7 +365,7 @@ def status(opts, args=None):
git("status")
def commit(opts, args=None):
git("""commit -m "%s" """ % opts[0].replace('"', '\"'))
git("""commit -a -m "%s" """ % opts[0].replace('"', '\"'))
def checkout(opts, args=None):
git(("checkout", opts[0]))