浏览代码

[minor] fixes in data import, serial no and setup wizard

version-14
Anand Doshi 11 年前
父节点
当前提交
fd84b62236
共有 3 个文件被更改,包括 5 次插入6 次删除
  1. +2
    -2
      core/page/data_import_tool/data_import_tool.py
  2. +1
    -2
      webnotes/utils/datautils.py
  3. +2
    -2
      wnf.py

+ 2
- 2
core/page/data_import_tool/data_import_tool.py 查看文件

@@ -498,7 +498,7 @@ def export_json(doctype, name, path):
d["__islocal"] = 1
outfile.write(json.dumps(doclist, default=json_handler, indent=1, sort_keys=True))

def import_doclist(path):
def import_doclist(path, overwrite=False):
import os
if os.path.isdir(path):
files = [os.path.join(path, f) for f in os.listdir(path)]
@@ -512,5 +512,5 @@ def import_doclist(path):
print "Imported: " + b.doc.doctype + " / " + b.doc.name
webnotes.conn.commit()
if f.endswith(".csv"):
import_file_by_path(f, ignore_links=True)
import_file_by_path(f, ignore_links=True, overwrite=overwrite)
webnotes.conn.commit()

+ 1
- 2
webnotes/utils/datautils.py 查看文件

@@ -49,7 +49,7 @@ def read_csv_content(fcontent, ignore_encoding=False):
raise_exception=True)

try:
reader = csv.reader(fcontent.encode("utf-8").splitlines())
reader = csv.reader(fcontent.encode("utf-8").splitlines(True))
# decode everything
rows = [[unicode(val, "utf-8").strip() for val in row] for row in reader]
return rows
@@ -91,7 +91,6 @@ class UnicodeWriter:
def check_record(d, parenttype=None, doctype_dl=None):
"""check for mandatory, select options, dates. these should ideally be in doclist"""
from webnotes.utils.dateutils import parse_date
if parenttype and not d.get('parent'):
webnotes.msgprint(_("Parent is required."), raise_exception=1)


+ 2
- 2
wnf.py 查看文件

@@ -447,10 +447,10 @@ def export_csv(doctype, path, site=None):
webnotes.destroy()

@cmd
def import_doclist(path, site=None):
def import_doclist(path, site=None, force=False):
from core.page.data_import_tool import data_import_tool
webnotes.connect(site=site)
data_import_tool.import_doclist(path)
data_import_tool.import_doclist(path, overwrite=force)
webnotes.destroy()
# translation


正在加载...
取消
保存