parent
56ef2316e4
commit
ab5555e144
|
@ -238,6 +238,10 @@ class EdocumentFileManager(object):
|
|||
|
||||
class EdocumentExportMixin(object):
|
||||
|
||||
def _default_template_path(self, message_type):
|
||||
return os.path.join(os.path.dirname(__file__),
|
||||
'template', message_type.lower() + '.txt')
|
||||
|
||||
def _write_file(self, file_path, file, encoding='utf-8'):
|
||||
edi_file = open(file_path, 'w+', encoding=encoding)
|
||||
edi_file.write(file)
|
||||
|
@ -253,8 +257,7 @@ class EdocumentExportMixin(object):
|
|||
if templates:
|
||||
return templates[0].template, templates[0].encoding
|
||||
else:
|
||||
template_path = os.path.join(os.path.dirname(__file__),
|
||||
'template', message_type.lower() + '.txt')
|
||||
template_path = self._default_template_path(message_type)
|
||||
with open(template_path) as file:
|
||||
template = file.read()
|
||||
return template, 'utf-8'
|
||||
|
|
Loading…
Reference in New Issue