core.modules.translation

Module Contents

Classes

Creator

Generic enumeration.

TranslationSkel

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

Translation

List module prototype.

class core.modules.translation.Creator

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

VIUR = 'viur'
USER = 'user'
class core.modules.translation.TranslationSkel(*args, **kwargs)

Bases: viur.core.skeleton.Skeleton

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
tr_key
translations
translations_missing
default_text
hint
usage_filename
usage_lineno
usage_variables
creator
classmethod toDB(skelValues, **kwargs)

Store current Skeleton entity to the Datastore.

Stores the current data of this instance into the database. If an key value is set to the object, this entity will ne updated; Otherwise a new entity will be created.

To read a Skeleton object from the data store, see fromDB().

Parameters:
  • update_relations – If False, this entity won’t be marked dirty; This avoids from being fetched by the background task updating relations.

  • skelValues (viur.core.skeleton.SkeletonInstance) –

Returns:

The datastore key of the entity.

Return type:

viur.core.db.Key

classmethod preProcessSerializedData(skelValues, entity)

Can be overridden to modify the viur.core.db.Entity before its actually written to the data store.

Parameters:
  • skelValues (viur.core.skeleton.SkeletonInstance) –

  • entity (viur.core.db.Entity) –

Return type:

viur.core.db.Entity

class core.modules.translation.Translation(moduleName, modulePath, *args, **kwargs)

Bases: viur.core.prototypes.list.List

List module prototype.

The list module prototype handles datasets in a flat list. It can be extended to filters and views to provide various use-cases.

It is undoubtedly the most frequently used prototype in any ViUR project.

Parameters:
  • moduleName (str) –

  • modulePath (str) –

kindName
roles
_last_reload
adminInfo()
onAdded(*args, **kwargs)

Hook function that is called after adding an entry.

It should be overridden for a module-specific behavior. The default is writing a log entry.

Parameters:

skel – The Skeleton that has been added.

See also

add(), , onAdd()

onEdited(*args, **kwargs)

Hook function that is called after modifying an entry.

It should be overridden for a module-specific behavior. The default is writing a log entry.

Parameters:

skel – The Skeleton that has been modified.

See also

edit(), onEdit()

onDeleted(*args, **kwargs)

Hook function that is called after deleting an entry.

It should be overridden for a module-specific behavior. The default is writing a log entry.

Parameters:

skel – The Skeleton that has been deleted.

See also

delete(), onDelete()

_reload_translations()