[in import] shifted global variable to webnotes

This commit is contained in:
Anand Doshi 2013-04-19 16:14:48 +05:30
parent c7c63a3f4a
commit c80fb24ec3
6 changed files with 7 additions and 13 deletions

View file

@ -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()

View file

@ -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

View file

@ -76,6 +76,7 @@ request_method = None
print_messages = False
user_lang = False
lang = 'en'
in_import = False
# memcache

View file

@ -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 =[]

View file

@ -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):

View file

@ -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()