diff --git a/core/doctype/doctype/doctype.py b/core/doctype/doctype/doctype.py index b0a1aebfbd..e91d07b96f 100644 --- a/core/doctype/doctype/doctype.py +++ b/core/doctype/doctype/doctype.py @@ -90,9 +90,7 @@ class DocType: self.change_modified_of_parent() import conf - from webnotes.modules.import_file import in_import - - if (not in_import) and getattr(conf,'developer_mode', 0): + if (not webnotes.in_import) and getattr(conf, 'developer_mode', 0): self.export_doc() self.make_controller_template() diff --git a/core/doctype/page/page.py b/core/doctype/page/page.py index e7cfbd8f38..3d13438b5e 100644 --- a/core/doctype/page/page.py +++ b/core/doctype/page/page.py @@ -53,8 +53,7 @@ class DocType: it will write out a .html file """ import conf - from webnotes.modules.import_file import in_import - if not in_import and getattr(conf,'developer_mode', 0) and self.doc.standard=='Yes': + if not webnotes.in_import and getattr(conf,'developer_mode', 0) and self.doc.standard=='Yes': from webnotes.modules.export_file import export_to_files from webnotes.modules import get_module_path, scrub import os diff --git a/webnotes/__init__.py b/webnotes/__init__.py index f51f3e59b3..70e3d9fa56 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -76,6 +76,7 @@ request_method = None print_messages = False user_lang = False lang = 'en' +in_import = False # memcache diff --git a/webnotes/modules/export_file.py b/webnotes/modules/export_file.py index 883d02c60d..cd71d16cd7 100644 --- a/webnotes/modules/export_file.py +++ b/webnotes/modules/export_file.py @@ -34,8 +34,7 @@ def export_to_files(record_list=[], record_module=None, verbose=0): """ Export record_list to files. record_list is a list of lists ([doctype],[docname] ) , """ - from webnotes.modules.import_file import in_import - if in_import: + if webnotes.in_import: return module_doclist =[] diff --git a/webnotes/modules/import_file.py b/webnotes/modules/import_file.py index bab9cb94e3..e460a990f8 100644 --- a/webnotes/modules/import_file.py +++ b/webnotes/modules/import_file.py @@ -25,8 +25,6 @@ from __future__ import unicode_literals import webnotes, os from webnotes.modules import scrub, get_module_path, scrub_dt_dn -in_import = False - def import_files(module, dt=None, dn=None, force=False): if type(module) is list: for m in module: @@ -36,14 +34,13 @@ def import_files(module, dt=None, dn=None, force=False): def import_file(module, dt, dn, force=False): """Sync a file from txt if modifed, return false if not updated""" - global in_import - in_import = True + webnotes.in_import = True dt, dn = scrub_dt_dn(dt, dn) path = os.path.join(get_module_path(module), os.path.join(dt, dn, dn + '.txt')) ret = import_file_by_path(path, force) - in_import = False + webnotes.in_import = False return ret def import_file_by_path(path, force=False): diff --git a/webnotes/widgets/reportview.py b/webnotes/widgets/reportview.py index 52aa899064..9b1132e57a 100644 --- a/webnotes/widgets/reportview.py +++ b/webnotes/widgets/reportview.py @@ -192,11 +192,11 @@ def build_filter_conditions(filters, conditions): def build_match_conditions(doctype, fields=None): """add match conditions if applicable""" + global tables match_conditions = [] match = True if not tables or not doctypes: - global tables tables = get_tables(doctype, fields) load_doctypes()