core.skeleton.instance¶
Classes¶
The actual wrapper around a Skeleton-Class. An object of this class is what's actually returned when you |
Module Contents¶
- class core.skeleton.instance.SkeletonInstance(skel_cls, entity=None, *, bones=(), bone_map=None, clone=False, clonedBoneMap=None)¶
The actual wrapper around a Skeleton-Class. An object of this class is what’s actually returned when you call a Skeleton-Class. With ViUR3, you don’t get an instance of a Skeleton-Class any more - it’s always this class. This is much faster as this is a small class.
Creates a new SkeletonInstance based on skel_cls.
- Parameters:
skel_cls (Type[core.skeleton.skeleton.Skeleton]) – Is the base skeleton class to inherit from and reference to.
bones (Iterable[str]) – If given, defines an iterable of bones that are take into the SkeletonInstance. The order of the bones defines the order in the SkeletonInstance.
bone_map (Optional[Dict[str, core.bones.base.BaseBone]]) – A pre-defined bone map to use, or extend.
clone (bool) – If set True, performs a cloning of the used bone map, to be entirely stand-alone.
entity (Optional[viur.core.db.Entity | dict])
clonedBoneMap (Optional[Dict[str, core.bones.base.BaseBone]])
- __slots__¶
- _cascade_deletion = False¶
- accessedValues¶
- dbEntity = None¶
- errors = []¶
- is_cloned = False¶
- renderAccessedValues¶
- renderPreparation = None¶
- skeletonCls¶
- items(yieldBoneValues=False)¶
- Parameters:
yieldBoneValues (bool)
- Return type:
Iterable[tuple[str, core.bones.base.BaseBone]]
- keys()¶
- Return type:
Iterable[str]
- values()¶
- Return type:
Iterable[Any]
- __iter__()¶
- Return type:
Iterable[str]
- __contains__(item)¶
- __bool__()¶
- get(item, default=None)¶
- update(*args, **kwargs)¶
- Return type:
None
- __setitem__(key, value)¶
- __getitem__(key)¶
- __getattr__(item)¶
Get a special attribute from the SkeletonInstance
__getattr__ is called when an attribute access fails with an AttributeError. So we know that this is not a real attribute of the SkeletonInstance. But there are still a few special cases in which attributes are loaded from the skeleton class.
- Parameters:
item (str)
- __delattr__(item)¶
- __setattr__(key, value)¶
- __repr__()¶
- Return type:
str
- __str__()¶
- Return type:
str
- __len__()¶
- Return type:
int
- __ior__(other)¶
- Parameters:
other (dict | SkeletonInstance | viur.core.db.Entity)
- Return type:
- clone(*, apply_clone_strategy=False)¶
Clones a SkeletonInstance into a modificable, stand-alone instance. This will also allow to modify the underlying data model.
- Parameters:
apply_clone_strategy (bool)
- Return type:
Self
- ensure_is_cloned()¶
Ensured this SkeletonInstance is a stand-alone clone, which can be modified. Does nothing in case it was already cloned before.
- setEntity(entity)¶
- Parameters:
entity (viur.core.db.Entity)
- structure()¶
- Return type:
dict
- dump()¶
Return a simplified version of the bone values in this skeleton. This can be used for example in the JSON renderer.
- __deepcopy__(memodict)¶