Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
660662f4
Commit
660662f4
authored
Apr 26, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Folder: do not silently ignore non existant id generator
parent
905e20d9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
product/ERP5Type/Core/Folder.py
product/ERP5Type/Core/Folder.py
+1
-2
product/ERP5Type/tests/testFolder.py
product/ERP5Type/tests/testFolder.py
+6
-1
No files found.
product/ERP5Type/Core/Folder.py
View file @
660662f4
...
...
@@ -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
()
...
...
product/ERP5Type/tests/testFolder.py
View file @
660662f4
...
...
@@ -112,6 +112,11 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor):
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
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment