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

Commit

Permalink
Merge pull request #113 from viur-framework/feature/predefineGetAvail…
Browse files Browse the repository at this point in the history
…ableRootNodes

Added getAvailableRootNodes stub
  • Loading branch information
tsteinruecken committed Dec 5, 2018
2 parents 491c663 + 66bcde4 commit 409bb61
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions prototypes/hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,30 @@ def isOwnUserRootNode(self, repo):

return False

def getAvailableRootNodes(self, *args, **kwargs):
"""
Default function for providing a list of root node items.
This list is requested by several module-internal functions and *must* be
overridden by a custom functionality. The default stub for this function
returns an empty list.
An example implementation could be the following:
.. code-block:: python
def getAvailableRootNodes(self, *args, **kwargs):
q = db.Query(self.rootKindName)
ret = [{"key": str(e.key()),
"name": e.get("name", str(e.key().id_or_name()))}
for e in q.run(limit=25)]
return ret
:param args: Can be used in custom implementations.
:param kwargs: Can be used in custom implementations.
:return: Returns a list of dicts which must provide a "key" and a "name" entry with \
respective information.
:rtype: list of dict
"""
return []

@callDeferred
def deleteRecursive(self, key):
"""
Expand Down

0 comments on commit 409bb61

Please sign in to comment.