Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Commit 409bb61

Browse files
Merge pull request #113 from viur-framework/feature/predefineGetAvailableRootNodes
Added getAvailableRootNodes stub
2 parents 491c663 + 66bcde4 commit 409bb61

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

prototypes/hierarchy.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,30 @@ def isOwnUserRootNode(self, repo):
181181

182182
return False
183183

184+
def getAvailableRootNodes(self, *args, **kwargs):
185+
"""
186+
Default function for providing a list of root node items.
187+
This list is requested by several module-internal functions and *must* be
188+
overridden by a custom functionality. The default stub for this function
189+
returns an empty list.
190+
An example implementation could be the following:
191+
.. code-block:: python
192+
193+
def getAvailableRootNodes(self, *args, **kwargs):
194+
q = db.Query(self.rootKindName)
195+
ret = [{"key": str(e.key()),
196+
"name": e.get("name", str(e.key().id_or_name()))}
197+
for e in q.run(limit=25)]
198+
return ret
199+
200+
:param args: Can be used in custom implementations.
201+
:param kwargs: Can be used in custom implementations.
202+
:return: Returns a list of dicts which must provide a "key" and a "name" entry with \
203+
respective information.
204+
:rtype: list of dict
205+
"""
206+
return []
207+
184208
@callDeferred
185209
def deleteRecursive(self, key):
186210
"""

0 commit comments

Comments
 (0)