@@ -18,7 +18,7 @@ import webnotes | |||||
import webnotes.model | import webnotes.model | ||||
import webnotes.model.doc | import webnotes.model.doc | ||||
import webnotes.model.doclist | import webnotes.model.doclist | ||||
from webnotes.utils import cint | |||||
from webnotes.utils import cint, get_base_path | |||||
doctype_cache = webnotes.local('doctype_doctype_cache') | doctype_cache = webnotes.local('doctype_doctype_cache') | ||||
docfield_types = webnotes.local('doctype_docfield_types') | docfield_types = webnotes.local('doctype_docfield_types') | ||||
@@ -281,7 +281,7 @@ def add_embedded_js(doc): | |||||
doc.fields['__js'] = ((doc.fields.get('__js') or '') + '\n' + custom).encode("utf-8") | doc.fields['__js'] = ((doc.fields.get('__js') or '') + '\n' + custom).encode("utf-8") | ||||
def _sub(match): | def _sub(match): | ||||
fpath = os.path.join(os.path.dirname(conf.__file__), \ | |||||
fpath = os.path.join(get_base_path(), \ | |||||
re.search('["\'][^"\']*["\']', match.group(0)).group(0)[1:-1]) | re.search('["\'][^"\']*["\']', match.group(0)).group(0)[1:-1]) | ||||
if os.path.exists(fpath): | if os.path.exists(fpath): | ||||
with open(fpath, 'r') as f: | with open(fpath, 'r') as f: | ||||
@@ -10,6 +10,7 @@ import webnotes | |||||
import os | import os | ||||
import conf | import conf | ||||
from webnotes.modules.import_file import import_file | from webnotes.modules.import_file import import_file | ||||
from webntoes.utils import get_base_path | |||||
def sync_all(force=0): | def sync_all(force=0): | ||||
sync_for("lib", force) | sync_for("lib", force) | ||||
@@ -17,7 +18,7 @@ def sync_all(force=0): | |||||
webnotes.clear_cache() | webnotes.clear_cache() | ||||
def sync_for(folder, force=0, sync_everything = False): | def sync_for(folder, force=0, sync_everything = False): | ||||
return walk_and_sync(os.path.join(os.path.dirname(os.path.abspath(conf.__file__)), | |||||
return walk_and_sync(os.path.join(get_base_path(), | |||||
folder), force, sync_everything) | folder), force, sync_everything) | ||||
def walk_and_sync(start_path, force=0, sync_everything = False): | def walk_and_sync(start_path, force=0, sync_everything = False): | ||||
@@ -46,4 +47,4 @@ def walk_and_sync(start_path, force=0, sync_everything = False): | |||||
webnotes.conn.commit() | webnotes.conn.commit() | ||||
return modules | |||||
return modules |
@@ -26,7 +26,7 @@ def get_module_path(module): | |||||
"""Returns path of the given module""" | """Returns path of the given module""" | ||||
m = scrub(module) | m = scrub(module) | ||||
app_path = os.path.dirname(conf.__file__) | |||||
app_path = webnotes.utils.get_base_path() | |||||
if m in ('core', 'website'): | if m in ('core', 'website'): | ||||
return os.path.join(app_path, 'lib', m) | return os.path.join(app_path, 'lib', m) | ||||
@@ -50,4 +50,4 @@ def export_doc(doctype, name, module=None): | |||||
write_document_file(webnotes.model.doc.get(doctype, name), module) | write_document_file(webnotes.model.doc.get(doctype, name), module) | ||||
def get_doctype_module(doctype): | def get_doctype_module(doctype): | ||||
return webnotes.conn.get_value('DocType', doctype, 'module') | |||||
return webnotes.conn.get_value('DocType', doctype, 'module') |
@@ -17,7 +17,7 @@ from datetime import datetime | |||||
#Global constants | #Global constants | ||||
verbose = 0 | verbose = 0 | ||||
import conf | |||||
from webnotes import conf | |||||
#------------------------------------------------------------------------------- | #------------------------------------------------------------------------------- | ||||
class BackupGenerator: | class BackupGenerator: | ||||
""" | """ | ||||
@@ -70,8 +70,7 @@ class BackupGenerator: | |||||
self.backup_path_db = this_file_path | self.backup_path_db = this_file_path | ||||
def zip_files(self): | def zip_files(self): | ||||
# TODO use get_storage_base_path | |||||
files_path = os.path.join(os.path.dirname(os.path.abspath(conf.__file__)), 'public', 'files') | |||||
files_path = webnotes.utils.get_storage_path(conf.files_path) | |||||
cmd_string = """tar -cf %s %s""" % (self.backup_path_files, files_path) | cmd_string = """tar -cf %s %s""" % (self.backup_path_files, files_path) | ||||
err, out = webnotes.utils.execute_in_shell(cmd_string) | err, out = webnotes.utils.execute_in_shell(cmd_string) | ||||
@@ -186,10 +185,8 @@ def get_backup_path(): | |||||
global backup_path | global backup_path | ||||
if not backup_path: | if not backup_path: | ||||
import os | import os | ||||
from webnotes import conf | |||||
# TODO Use get_storage_base_path | # TODO Use get_storage_base_path | ||||
backup_path = os.path.join(os.path.dirname(os.path.abspath(conf.__file__)), | |||||
'public', 'backups') | |||||
backup_path = webnotes.utils.get_storage_path(conf.backup_path) | |||||
return backup_path | return backup_path | ||||
#------------------------------------------------------------------------------- | #------------------------------------------------------------------------------- | ||||