core.prototypes.skelmodule

Module Contents

Classes

SkelModule

This is the extended module prototype used by any other ViUR module prototype.

class core.prototypes.skelmodule.SkelModule(*args, **kwargs)

Bases: viur.core.Module

This is the extended module prototype used by any other ViUR module prototype. It a prototype which generally is bound to some database model abstracted by the ViUR skeleton system.

kindName: str

Name of the datastore kind that is handled by this module.

This information is used to bind a specific viur.core.skeleton.Skeleton-class to this prototype. By default, it is automatically determined from the module’s class name, so a module named Animal refers to a Skeleton named AnimalSkel and its kindName is animal.

For more information, refer to the function _resolveSkelCls().

accessRights: Tuple[str]

If set, a tuple of access rights (like add, edit, delete) that this module supports.

These will be prefixed on instance startup with the actual module name (becoming file-add, file-edit etc) and registered in conf["viur.accessRights"] so these will be available on the access bone in user/add or user/edit.

_resolveSkelCls(*args, **kwargs) Type[viur.core.skeleton.Skeleton]

Retrieve the generally associated viur.core.skeleton.Skeleton that is used by the application.

This is either be defined by the member variable kindName or by a Skeleton named like the application class in lower-case order.

If this behavior is not wanted, it can be definitely overridden by defining module-specific viewSkel(), addSkel(), or editSkel() functions, or by overriding this function in general.

Returns:

Returns a Skeleton class that matches the application.

baseSkel(*args, **kwargs) viur.core.skeleton.SkeletonInstance

Returns an instance of an unmodified base skeleton for this module.

This function should only be used in cases where a full, unmodified skeleton of the module is required, e.g. for administrative or maintenance purposes.

By default, baseSkel is used by viewSkel(), addSkel(), and editSkel().