Commit 0f69875c authored by Romain Courteaud's avatar Romain Courteaud

Keep business_template_registered_skin_selections when updating a skin folder


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29185 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 198e6c26
...@@ -965,6 +965,15 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -965,6 +965,15 @@ class ObjectTemplateItem(BaseTemplateItem):
'ERP5 Distributed Ram Cache',): 'ERP5 Distributed Ram Cache',):
assert container.meta_type == 'ERP5 Cache Factory' assert container.meta_type == 'ERP5 Cache Factory'
container.getParentValue().updateCache() container.getParentValue().updateCache()
elif (container.meta_type == 'CMF Skins Tool') and \
(old_obj is not None):
# Keep previous value of register skin selection for skin folder
skin_selection_list = old_obj.getProperty(
'business_template_registered_skin_selections', None)
if skin_selection_list is not None:
obj._setProperty(
'business_template_registered_skin_selections',
skin_selection_list, type='tokens')
recurse(restoreHook, obj) recurse(restoreHook, obj)
# now put original order group # now put original order group
......
...@@ -4603,6 +4603,10 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -4603,6 +4603,10 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
self.assertTrue(skin_id in layers, layers) self.assertTrue(skin_id in layers, layers)
self.assertTrue('erp5_core' in layers, layers) self.assertTrue('erp5_core' in layers, layers)
self.assertFalse('erp5_xhtml_style' in layers, layers) self.assertFalse('erp5_xhtml_style' in layers, layers)
skin_folder = ps._getOb(skin_id, None)
skin_selection_list = skin_folder.getProperty(
'business_template_registered_skin_selections', ())
self.assertTrue('Foo' in skin_selection_list)
def stepCheckStaticSkinSelection(self, sequence=None, **kw): def stepCheckStaticSkinSelection(self, sequence=None, **kw):
ps = self.getSkinsTool() ps = self.getSkinsTool()
...@@ -5576,6 +5580,88 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -5576,6 +5580,88 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
def stepModifySkinFolder(self, sequence=None,sequence_list=None, **kw):
"""
Modify the skin folder
"""
ps = self.getSkinsTool()
skin_id = sequence.get('skin_folder_id')
skin_folder = ps._getOb(skin_id, None)
skin_folder._setProperty(
'business_template_skin_layer_priority',
99, type='float')
def stepUnmodifySkinFolder(self, sequence=None,sequence_list=None, **kw):
"""
Modify the skin folder
"""
ps = self.getSkinsTool()
skin_id = sequence.get('skin_folder_id')
skin_folder = ps._getOb(skin_id, None)
skin_folder._delProperty('business_template_skin_layer_priority')
def stepCheckModifiedSkinFolderExists(self, sequence=None,
sequence_list=None, **kw):
"""
Check modified skin folder
"""
ps = self.getSkinsTool()
skin_id = sequence.get('skin_folder_id')
skin_folder = ps._getOb(skin_id, None)
self.assertEquals(
99, skin_folder.getProperty('business_template_skin_layer_priority'))
def test_163_UpdateSkinFolderWithRegisteredSkinSelection(
self, quiet=quiet, run=run_all_test):
if not run: return
if not quiet:
message = 'Test Update Skin Folder'
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ', 0, message)
sequence_list = SequenceList()
sequence_string = '\
CreateSkinFolder \
SetSkinFolderRegistredSelections \
CreateNewBusinessTemplate \
UseExportBusinessTemplate \
AddSkinFolderToBusinessTemplate \
AddRegistredSelectionToBusinessTemplate \
BuildBusinessTemplate \
SaveBusinessTemplate \
RemoveSkinFolder \
RemoveBusinessTemplate \
RemoveAllTrashBins \
\
ImportBusinessTemplate \
UseImportBusinessTemplate \
InstallBusinessTemplate \
Tic \
CheckSkinSelectionAdded \
\
ModifySkinFolder \
\
CopyBusinessTemplate \
Tic \
EditBusinessTemplate \
BuildBusinessTemplate \
CheckBuiltBuildingState \
SaveBusinessTemplate \
\
UnmodifySkinFolder \
\
ImportBusinessTemplate \
Tic \
UseImportBusinessTemplate \
InstallWithoutForceBusinessTemplate \
Tic \
\
CheckModifiedSkinFolderExists \
CheckSkinSelectionAdded \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestBusinessTemplate)) suite.addTest(unittest.makeSuite(TestBusinessTemplate))
......
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