core.bones.keyBone

Module Contents

Classes

keyBone

class core.bones.keyBone.keyBone(descr='Key', readOnly=True, visible=False, **kwargs)

Bases: viur.core.bones.bone.baseBone

type = key
unserialize(self, skel: viur.core.skeleton.SkeletonValues, name: str) bool

Inverse of serialize. Evaluates whats read from the datastore and populates this bone accordingly. :param name: The property-name this bone has in its Skeleton (not the description!) :type name: str :param expando: An instance of the dictionary-like db.Entity class :type expando: db.Entity :returns: bool

serialize(self, skel: SkeletonInstance, name: str, parentIndexed: bool) bool

Serializes this bone into something we can write into the datastore.

Parameters

name (str) – The property-name this bone has in its Skeleton (not the description!)

Returns

dict

buildDBFilter(self, name, skel, dbFilter, rawFilter, prefix=None)

Parses the searchfilter a client specified in his Request into something understood by the datastore. This function must:

  • Ignore all filters not targeting this bone

  • Safely handle malformed data in rawFilter

    (this parameter is directly controlled by the client)

Parameters
  • name (str) – The property-name this bone has in its Skeleton (not the description!)

  • skel (server.skeleton.Skeleton) – The server.db.Query this bone is part of

  • dbFilter (server.db.Query) – The current server.db.Query instance the filters should be applied to

  • rawFilter (dict) – The dictionary of filters the client wants to have applied

Returns

The modified server.db.Query