core.bones.raw

Attributes

SEARCH_TAGS

Classes

RawBone

Stores its data without applying any pre/post-processing or filtering. Can be used to store

Module Contents

core.bones.raw.SEARCH_TAGS
class core.bones.raw.RawBone(*, compute=None, defaultValue=None, descr=None, getEmptyValueFunc=None, indexed=True, isEmptyFunc=None, languages=None, multiple=False, params=None, readOnly=None, required=False, searchable=False, type_suffix='', unique=None, vfunc=None, visible=True, clone_behavior=None)

Bases: viur.core.bones.base.BaseBone

Stores its data without applying any pre/post-processing or filtering. Can be used to store non-html content. Use the dot-notation like “raw.markdown” or similar to describe subsequent types.

..Warning: Using this bone will lead to security vulnerabilities like reflected XSS unless the

data is either otherwise validated/stripped or from a trusted source! Don’t use this unless you fully understand it’s implications!

Initializes a new Bone.

Parameters:
  • compute (Compute)

  • defaultValue (Any)

  • descr (Optional[str | viur.core.i18n.translate])

  • getEmptyValueFunc (callable)

  • indexed (bool)

  • isEmptyFunc (callable)

  • languages (None | list[str])

  • multiple (bool | MultipleConstraints)

  • params (dict)

  • readOnly (bool)

  • required (bool | list[str] | tuple[str])

  • searchable (bool)

  • type_suffix (str)

  • unique (None | UniqueValue)

  • vfunc (callable)

  • visible (bool)

  • clone_behavior (CloneBehavior | CloneStrategy | None)

type = 'raw'
singleValueFromClient(value, skel, bone_name, client_data)

Load a single value from a client

Parameters:
  • value – The single value which should be loaded.

  • skel – The SkeletonInstance where the value should be loaded into.

  • bone_name – The bone name of this bone in the SkeletonInstance.

  • client_data – The data taken from the client, a dictionary with usually bone names as key

Returns:

A tuple. If the value is valid, the first element is the parsed value and the second is None. If the value is invalid or not parseable, the first element is a empty value and the second a list of ReadFromClientError.

getSearchTags(skel, name)

Returns a set of strings as search index for this bone.

This function extracts a set of search tags from the given bone’s value in the skeleton instance. The resulting set can be used for indexing or searching purposes.

Parameters:
  • skel (SkeletonInstance) – The skeleton instance where the values should be loaded from. This is an instance of a class derived from viur.core.skeleton.SkeletonInstance.

  • name (str) – The name of the bone, which is a string representing the key for the bone in the skeleton. This should correspond to an existing bone in the skeleton instance.

Returns:

A set of strings, extracted from the bone value. If the bone value doesn’t have any searchable content, an empty set is returned.

Return type:

set[str]