Commit b7014b83 authored by Vincent Pelletier's avatar Vincent Pelletier

Split NodeManager.createFromNodeType into 2 methods for reusability.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2044 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent b5659e15
......@@ -408,11 +408,14 @@ class NodeManager(object):
""" Create and register a new admin """
return self._createNode(AdminNode, **kw)
def createFromNodeType(self, node_type, **kw):
def _getClassFromNodeType(self, node_type):
klass = NODE_TYPE_MAPPING.get(node_type)
if klass is None:
raise RuntimeError('Unknown node type : %s' % node_type)
return self._createNode(klass, **kw)
return klass
def createFromNodeType(self, node_type, **kw):
return self._createNode(self._getClassFromNodeType(node_type), **kw)
def init(self):
self._node_set.clear()
......
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