Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
erp5
Commits
2fcda5b2
Commit
2fcda5b2
authored
Nov 18, 2014
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check that the ID generated is valid, if not fallback to default generator
parent
d2e055cf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
product/ERP5Type/Core/Folder.py
product/ERP5Type/Core/Folder.py
+9
-3
No files found.
product/ERP5Type/Core/Folder.py
View file @
2fcda5b2
...
@@ -32,7 +32,8 @@ from collections import deque
...
@@ -32,7 +32,8 @@ from collections import deque
from
AccessControl
import
ClassSecurityInfo
,
getSecurityManager
from
AccessControl
import
ClassSecurityInfo
,
getSecurityManager
from
AccessControl.ZopeGuards
import
NullIter
from
AccessControl.ZopeGuards
import
NullIter
from
Acquisition
import
aq_base
,
aq_parent
,
aq_inner
from
Acquisition
import
aq_base
,
aq_parent
,
aq_inner
from
OFS.ObjectManager
import
ObjectManager
from
OFS.ObjectManager
import
ObjectManager
,
checkValidId
from
zExceptions
import
BadRequest
from
OFS.History
import
Historical
from
OFS.History
import
Historical
import
ExtensionClass
import
ExtensionClass
...
@@ -216,13 +217,18 @@ class FolderMixIn(ExtensionClass.Base):
...
@@ -216,13 +217,18 @@ class FolderMixIn(ExtensionClass.Base):
def
_generatePerNodeId
(
self
):
def
_generatePerNodeId
(
self
):
"""
"""
Generate id base on
node-id defined in
zope.conf,
Generate id base on
the node id defined in the
zope.conf,
useful for import and mass creation
useful for import and mass creation
of objects inside a module using activities
of objects inside a module using activities
We also append random id
We also append random id
"""
"""
activity_tool
=
self
.
getPortalObject
().
portal_activities
activity_tool
=
self
.
getPortalObject
().
portal_activities
return
"%s-%s"
%
(
activity_tool
.
getCurrentNode
(),
self
.
_generateRandomId
())
new_id
=
"%s-%s"
%
(
activity_tool
.
getCurrentNode
(),
self
.
_generateRandomId
())
try
:
checkValidId
(
new_id
)
except
BadRequest
:
return
self
.
_generateNextId
()
return
new_id
def
_generatePerNodeNumberId
(
self
):
def
_generatePerNodeNumberId
(
self
):
"""
"""
...
...
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