core.modules.page

Module Contents

Classes

PageSkel

This is a container-object holding information about one database entity.

Page

Tree module prototype.

class core.modules.page.PageSkel(*args, **kwargs)

Bases: viur.core.prototypes.tree.TreeSkel

This is a container-object holding information about one database entity.

It has to be sub-classed with individual information about the kindName of the entities and its specific data attributes, the so called bones. The Skeleton stores its bones in an OrderedDict-Instance, so the definition order of the contained bones remains constant.

Variables:
  • key (server.bones.BaseBone) – This bone stores the current database key of this entity. Assigning to this bones value is dangerous and does not affect the actual key its stored in.

  • creationdate (server.bones.DateBone) – The date and time where this entity has been created.

  • changedate (server.bones.DateBone) – The date and time of the last change to this entity.

kindName = 'page'
searchindex = 'page'
name
descr
class core.modules.page.Page(moduleName, modulePath, *args, **kwargs)

Bases: viur.core.prototypes.tree.Tree

Tree module prototype.

It is used for hierarchical structures, either as a tree with nodes and leafs, or as a hierarchy with nodes only.

adminInfo
viewTemplate = 'page_view'
getAvailableRootNodes(*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:

# Example
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()))} #FIXME
        for e in q.run(limit=25)]
    return ret
Parameters:
  • args – Can be used in custom implementations.

  • kwargs – Can be used in custom implementations.

Returns:

Returns a list of dicts which must provide a “key” and a “name” entry with respective information.