Commit 87e565db authored by Aurel's avatar Aurel

add generator usefull for mass creation inside the same module using activities

parent 719c3361
...@@ -213,6 +213,22 @@ class FolderMixIn(ExtensionClass.Base): ...@@ -213,6 +213,22 @@ class FolderMixIn(ExtensionClass.Base):
self._setLastId(my_id) # Make sure no reindexing happens self._setLastId(my_id) # Make sure no reindexing happens
return my_id return my_id
def _generatePerNodeNumberId(self):
"""
Generate id base on node number, useful for import and mass creation
of objects inside a module using activities
We also append random id
"""
activity_tool = self.getPortalObject().portal_activities
node_list = list(activity_tool.getNodeList())
current_node = activity_tool.getCurrentNode()
try:
node_number = node_list.index(current_node)
except ValueError:
# Not a processing node
node_number = 111
return "%03d-%s" %(node_number, self._generateRandomId())
# Automatic ID Generation method # Automatic ID Generation method
security.declareProtected(Permissions.View, 'generateNewId') security.declareProtected(Permissions.View, 'generateNewId')
def generateNewId(self,id_group=None,default=None,method=None): def generateNewId(self,id_group=None,default=None,method=None):
......
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