Commit ad0be1ff authored by Aurel's avatar Aurel

raise exception if business template is not 'built' for exporting

remove unused exported property of business template


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4142 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 51b186e2
...@@ -224,6 +224,8 @@ class BusinessTemplateTarball(BusinessTemplateArchive): ...@@ -224,6 +224,8 @@ class BusinessTemplateTarball(BusinessTemplateArchive):
tar.close() tar.close()
io.close() io.close()
class TemplateConditionError(Exception): pass
class TemplateConflictError(Exception): pass class TemplateConflictError(Exception): pass
class BaseTemplateItem(Implicit, Persistent): class BaseTemplateItem(Implicit, Persistent):
...@@ -2369,6 +2371,10 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -2369,6 +2371,10 @@ Business Template is a set of definitions, such as skins, portal types and categ
""" """
Export this Business Template Export this Business Template
""" """
if self.getBuildingState() != 'built':
raise TemplateConditionError, 'Business Template must be build before export'
if local: if local:
# we export into a folder tree # we export into a folder tree
bta = BusinessTemplateFolder(creation=1, path=path) bta = BusinessTemplateFolder(creation=1, path=path)
...@@ -2381,8 +2387,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -2381,8 +2387,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
for prop in self.propertyMap(): for prop in self.propertyMap():
type = prop['type'] type = prop['type']
id = prop['id'] id = prop['id']
# if id in ('uid', 'rid', 'sid', 'id_group', 'last_id'): if id in ('uid', 'rid', 'sid', 'id_group', 'last_id'):
if id in ('uid'): # maybe remove rid, sid
continue continue
value = self.getProperty(id) value = self.getProperty(id)
if type == 'text' or type == 'string' or type == 'int': if type == 'text' or type == 'string' or type == 'int':
......
...@@ -190,7 +190,7 @@ class TemplateTool (BaseTool): ...@@ -190,7 +190,7 @@ class TemplateTool (BaseTool):
for prop in bt.propertyMap(): for prop in bt.propertyMap():
type = prop['type'] type = prop['type']
pid = prop['id'] pid = prop['id']
if pid in ('uid', 'id'): if pid in ('uid', 'id', 'rid', 'sid', 'id_group', 'last_id'):
continue continue
prop_path = os.path.join(tar.members[0].name, 'bt', pid) prop_path = os.path.join(tar.members[0].name, 'bt', pid)
info = tar.getmember(prop_path) info = tar.getmember(prop_path)
...@@ -234,7 +234,7 @@ class TemplateTool (BaseTool): ...@@ -234,7 +234,7 @@ class TemplateTool (BaseTool):
for prop in bt.propertyMap(): for prop in bt.propertyMap():
type = prop['type'] type = prop['type']
pid = prop['id'] pid = prop['id']
if pid in ('uid', 'id'): if pid in ('uid', 'id', 'rid', 'sid', 'id_group', 'last_id'):
continue continue
prop_path = os.path.join(bt_path, pid) prop_path = os.path.join(bt_path, pid)
value = open(prop_path, 'r').read() value = open(prop_path, 'r').read()
......
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