From c0439311101d8ecc737a03ca4d2136cae8bcf5fd Mon Sep 17 00:00:00 2001 From: "St.Huang" Date: Sun, 23 Sep 2018 00:29:52 +0800 Subject: [PATCH] fix #61 --- addons/fastwq/query/common.py | 17 ++++++++--------- addons/fastwq/service/base.py | 4 +++- addons21/fastwq/query/common.py | 17 ++++++++--------- addons21/fastwq/service/base.py | 4 +++- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/addons/fastwq/query/common.py b/addons/fastwq/query/common.py index 5b27706..38a8975 100644 --- a/addons/fastwq/query/common.py +++ b/addons/fastwq/query/common.py @@ -170,16 +170,15 @@ def add_to_tmpl(note, **kwargs): #copy_static_file(jsfile, new_jsfile) #addings = u'\r\n'.format(new_jsfile) jsfile = jsfile if isinstance(jsfile, list) else [jsfile] - addings = u'' for fn in jsfile: - try: - f = io.open(fn, mode="r", encoding="utf-8") - addings += u'\n'.format(f.read()) - f.close() - except: - pass - if addings not in afmt: - afmt += addings + addings = ''' +'''.format(fn) + if addings not in afmt: + afmt += addings note.model()['tmpls'][0]['afmt'] = afmt diff --git a/addons/fastwq/service/base.py b/addons/fastwq/service/base.py index 7d95f10..56f538d 100644 --- a/addons/fastwq/service/base.py +++ b/addons/fastwq/service/base.py @@ -721,7 +721,9 @@ class MdxService(LocalService): keys = self.builder.get_mdd_keys(each) if not keys: errors.append(each) - lst.extend(keys) + lst.append(each[1:]) + else: + lst.extend(keys) for each in lst: self.save_default_file(each) except AttributeError: diff --git a/addons21/fastwq/query/common.py b/addons21/fastwq/query/common.py index 3488a3e..be9786f 100644 --- a/addons21/fastwq/query/common.py +++ b/addons21/fastwq/query/common.py @@ -171,16 +171,15 @@ def add_to_tmpl(note, **kwargs): #addings = u'\r\n'.format(new_jsfile) #afmt += addings jsfile = jsfile if isinstance(jsfile, list) else [jsfile] - addings = u'' for fn in jsfile: - try: - with open(fn, 'r', encoding="utf-8") as f: - addings += u'\n'.format(f.read()) - f.close() - except: - pass - if addings not in afmt: - afmt += addings + addings = ''' +'''.format(fn) + if addings not in afmt: + afmt += addings note.model()['tmpls'][0]['afmt'] = afmt diff --git a/addons21/fastwq/service/base.py b/addons21/fastwq/service/base.py index ca31772..2361352 100644 --- a/addons21/fastwq/service/base.py +++ b/addons21/fastwq/service/base.py @@ -728,7 +728,9 @@ class MdxService(LocalService): keys = self.builder.get_mdd_keys(each) if not keys: errors.append(each) - lst.extend(keys) + lst.append(each[1:]) + else: + lst.extend(keys) for each in lst: self.save_default_file(each) except AttributeError: