Browse Source

[in import] shifted global variable to webnotes

version-14
Anand Doshi 12 years ago
parent
commit
c80fb24ec3
6 changed files with 7 additions and 13 deletions
  1. +1
    -3
      core/doctype/doctype/doctype.py
  2. +1
    -2
      core/doctype/page/page.py
  3. +1
    -0
      webnotes/__init__.py
  4. +1
    -2
      webnotes/modules/export_file.py
  5. +2
    -5
      webnotes/modules/import_file.py
  6. +1
    -1
      webnotes/widgets/reportview.py

+ 1
- 3
core/doctype/doctype/doctype.py View File

@@ -90,9 +90,7 @@ class DocType:
self.change_modified_of_parent() self.change_modified_of_parent()
import conf 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.export_doc()
self.make_controller_template() self.make_controller_template()




+ 1
- 2
core/doctype/page/page.py View File

@@ -53,8 +53,7 @@ class DocType:
it will write out a .html file it will write out a .html file
""" """
import conf 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.export_file import export_to_files
from webnotes.modules import get_module_path, scrub from webnotes.modules import get_module_path, scrub
import os import os


+ 1
- 0
webnotes/__init__.py View File

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


# memcache # memcache




+ 1
- 2
webnotes/modules/export_file.py 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] ) , 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 return
module_doclist =[] module_doclist =[]


+ 2
- 5
webnotes/modules/import_file.py View File

@@ -25,8 +25,6 @@ from __future__ import unicode_literals
import webnotes, os import webnotes, os
from webnotes.modules import scrub, get_module_path, scrub_dt_dn from webnotes.modules import scrub, get_module_path, scrub_dt_dn


in_import = False

def import_files(module, dt=None, dn=None, force=False): def import_files(module, dt=None, dn=None, force=False):
if type(module) is list: if type(module) is list:
for m in module: 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): def import_file(module, dt, dn, force=False):
"""Sync a file from txt if modifed, return false if not updated""" """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) dt, dn = scrub_dt_dn(dt, dn)
path = os.path.join(get_module_path(module), path = os.path.join(get_module_path(module),
os.path.join(dt, dn, dn + '.txt')) os.path.join(dt, dn, dn + '.txt'))
ret = import_file_by_path(path, force) ret = import_file_by_path(path, force)
in_import = False
webnotes.in_import = False
return ret return ret


def import_file_by_path(path, force=False): def import_file_by_path(path, force=False):


+ 1
- 1
webnotes/widgets/reportview.py View File

@@ -192,11 +192,11 @@ def build_filter_conditions(filters, conditions):
def build_match_conditions(doctype, fields=None): def build_match_conditions(doctype, fields=None):
"""add match conditions if applicable""" """add match conditions if applicable"""
global tables
match_conditions = [] match_conditions = []
match = True match = True
if not tables or not doctypes: if not tables or not doctypes:
global tables
tables = get_tables(doctype, fields) tables = get_tables(doctype, fields)
load_doctypes() load_doctypes()


Loading…
Cancel
Save