core.render.json.default
¶
Module Contents¶
Classes¶
This custom JSON-Encoder for this json-render ensures that translations are evaluated and can be dumped. |
|
- 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(self, 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 aTypeError
).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(self, 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(self, skel: viur.core.skeleton.SkeletonInstance) Optional[List[Tuple[str, Dict[str, Any]]]] ¶
Dumps the structure of a
viur.core.skeleton.Skeleton
.- Parameters
skel – Skeleton which structure will be processed.
- Returns
The rendered dictionary.
- renderSingleBoneValue(self, value: Any, bone: viur.core.bones.BaseBone, skel: viur.core.skeleton.SkeletonInstance, key) Union[Dict, str, None] ¶
Renders the value of a bone.
This function is used by
collectSkelData()
. 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(self, bone: viur.core.bones.BaseBone, skel: viur.core.skeleton.SkeletonInstance, key: str) Union[List, Dict, None] ¶
- renderSkelValues(self, skel: viur.core.skeleton.SkeletonInstance, injectDownloadURL: bool = False) Optional[Dict] ¶
Prepares values of one
viur.core.skeleton.Skeleton
or a list of skeletons for output.- Parameters
skel – Skeleton which contents will be processed.
- renderEntry(self, skel: viur.core.skeleton.SkeletonInstance, actionName, params=None)¶
- view(self, skel: viur.core.skeleton.SkeletonInstance, action='view', params=None, *args, **kwargs)¶
- add(self, skel: viur.core.skeleton.SkeletonInstance, action='add', params=None, **kwargs)¶
- edit(self, skel: viur.core.skeleton.SkeletonInstance, action='edit', params=None, **kwargs)¶
- list(self, skellist, action='list', params=None, **kwargs)¶
- editSuccess(self, skel: viur.core.skeleton.SkeletonInstance, params=None, **kwargs)¶
- addSuccess(self, skel: viur.core.skeleton.SkeletonInstance, params=None, **kwargs)¶
- addDirSuccess(self, rootNode, path, dirname, params=None, *args, **kwargs)¶
- listRootNodes(self, rootNodes, tpl=None, params=None)¶
- listRootNodeContents(self, subdirs, entrys, tpl=None, params=None, **kwargs)¶
- renameSuccess(self, rootNode, path, src, dest, params=None, *args, **kwargs)¶
- copySuccess(self, srcrepo, srcpath, name, destrepo, destpath, type, deleteold, params=None, *args, **kwargs)¶
- deleteSuccess(self, skel: viur.core.skeleton.SkeletonInstance, params=None, *args, **kwargs)¶
- reparentSuccess(self, obj, tpl=None, params=None, *args, **kwargs)¶
- setIndexSuccess(self, obj, tpl=None, params=None, *args, **kwargs)¶
- cloneSuccess(self, tpl=None, params=None, *args, **kwargs)¶