core.render.json.default

Module Contents

Classes

CustomJsonEncoder

This custom JSON-Encoder for this json-render ensures that translations are evaluated and can be dumped.

DefaultRender

class core.render.json.default.CustomJsonEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)

Bases: json.JSONEncoder

This custom JSON-Encoder for this json-render ensures that translations are evaluated and can be dumped.

default(o: Any) Any

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
class core.render.json.default.DefaultRender(parent=None, *args, **kwargs)

Bases: object

kind = 'json'
renderBoneStructure(bone: viur.core.bones.BaseBone) Dict[str, Any]

Renders the structure of a bone.

This function is used by renderSkelStructure. can be overridden and super-called from a custom renderer.

Parameters:

bone (Any bone that inherits from server.bones.BaseBone.) – The bone which structure should be rendered.

Returns:

A dict containing the rendered attributes.

renderSkelStructure(skel: viur.core.skeleton.SkeletonInstance) List[Tuple[str, Dict[str, Any]]] | None

Dumps the structure of a viur.core.skeleton.Skeleton.

Parameters:

skel – Skeleton which structure will be processed.

Returns:

The rendered dictionary.

renderSingleBoneValue(value: Any, bone: viur.core.bones.BaseBone, skel: viur.core.skeleton.SkeletonInstance, key) Dict | str | None

Renders the value of a bone.

It can be overridden and super-called from a custom renderer.

Parameters:

bone (Any bone that inherits from server.bones.base.BaseBone.) – The bone which value should be rendered.

Returns:

A dict containing the rendered attributes.

renderBoneValue(bone: viur.core.bones.BaseBone, skel: viur.core.skeleton.SkeletonInstance, key: str) List | Dict | None
renderSkelValues(skel: viur.core.skeleton.SkeletonInstance, injectDownloadURL: bool = False) Dict | None

Prepares values of one viur.core.skeleton.Skeleton or a list of skeletons for output.

Parameters:

skel – Skeleton which contents will be processed.

renderEntry(skel: viur.core.skeleton.SkeletonInstance, actionName, params=None)
view(skel: viur.core.skeleton.SkeletonInstance, action: str = 'view', params=None, **kwargs)
list(skellist, action: str = 'list', params=None, **kwargs)
add(skel: viur.core.skeleton.SkeletonInstance, action: str = 'add', params=None, **kwargs)
edit(skel: viur.core.skeleton.SkeletonInstance, action: str = 'edit', params=None, **kwargs)
editSuccess(skel: viur.core.skeleton.SkeletonInstance, action: str = 'editSuccess', params=None, **kwargs)
addSuccess(skel: viur.core.skeleton.SkeletonInstance, action: str = 'addSuccess', params=None, **kwargs)
deleteSuccess(skel: viur.core.skeleton.SkeletonInstance, params=None, *args, **kwargs)
listRootNodes(rootNodes, *args, **kwargs)