Commit 069da986 authored by Aurel's avatar Aurel

explicitly set the format of Business Template at import for old version


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4397 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bb44ccc3
...@@ -190,7 +190,7 @@ class TemplateTool (BaseTool): ...@@ -190,7 +190,7 @@ class TemplateTool (BaseTool):
self._importObjectFromFile(path, id=id) self._importObjectFromFile(path, id=id)
bt = self[id] bt = self[id]
bt.id = id # Make sure id is consistent bt.id = id # Make sure id is consistent
bt._tarfile = 0 bt.setProperty('template_format_version', 0, type='int')
else: # new version else: # new version
tar = tarfile.open(path, 'r:gz') tar = tarfile.open(path, 'r:gz')
# create bt object # create bt object
...@@ -284,14 +284,12 @@ class TemplateTool (BaseTool): ...@@ -284,14 +284,12 @@ class TemplateTool (BaseTool):
return return
else : else :
raise 'Error', 'No file or an empty file was specified' raise 'Error', 'No file or an empty file was specified'
# copy to a temp location # copy to a temp location
import_file.seek(0) #Rewind to the beginning of file import_file.seek(0) #Rewind to the beginning of file
tempid, temppath = mkstemp() tempid, temppath = mkstemp()
tempfile = open(temppath, 'w') tempfile = open(temppath, 'w')
tempfile.write(import_file.read()) tempfile.write(import_file.read())
tempfile.close() tempfile.close()
bt = self._importBT(temppath, id) bt = self._importBT(temppath, id)
bt.build(no_action=1) bt.build(no_action=1)
bt.reindexObject() bt.reindexObject()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment