Commit 660662f4 authored by Jérome Perrin's avatar Jérome Perrin

Folder: do not silently ignore non existant id generator

parent 905e20d9
......@@ -256,7 +256,6 @@ class FolderMixIn(ExtensionClass.Base):
Permission is view because we may want to add content to a folder
without changing the folder content itself.
XXX
"""
my_id = None
if id_group is None:
......@@ -273,7 +272,7 @@ class FolderMixIn(ExtensionClass.Base):
# default value of id_generator and force safe fallback in this case.
idGenerator = getattr(self, id_generator, None)
if idGenerator is None:
idGenerator = self._generateNextId
raise ValueError("Could not find id_generator %r" % (id_generator,))
else:
idGenerator = self._generateNextId
my_id = idGenerator()
......
......@@ -111,7 +111,12 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor):
self.assertEquals(len(self.folder), expected_length)
obj = self.newContent()
self.assertEquals(obj.getId(), id_generator_id_list[expected_length])
def test_03_unkownGenerateNewId(self):
self.folder.setIdGenerator('no such method')
self.assertRaises(ValueError, self.folder.generateNewId)
self.assertRaises(ValueError, self.folder.newContent)
def _setAllowedContentTypesForFolderType(self, allowed_content_type_list):
"""Set allowed content types for Folder portal type."""
self.getTypesTool().Folder.edit(
......
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