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(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 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(self, bone)

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.base.baseBone.) – The bone which structure should be rendered.

Returns

A dict containing the rendered attributes.

Return type

dict

renderSkelStructure(self, skel)

Dumps the structure of a server.db.skeleton.Skeleton.

Parameters

skel (server.db.skeleton.Skeleton) – Skeleton which structure will be processed.

Returns

The rendered dictionary.

Return type

dict

renderSingleBoneValue(self, value, bone, skel, key)

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.

Return type

dict

renderBoneValue(self, bone, skel, key)
renderSkelValues(self, skel, injectDownloadURL=False)

Prepares values of one server.db.skeleton.Skeleton or a list of skeletons for output.

Parameters

skel (server.db.skeleton.Skeleton) – Skeleton which contents will be processed.

Returns

A dictionary or list of dictionaries.

Return type

dict

renderEntry(self, skel, actionName, params=None)
view(self, skel, action='view', params=None, *args, **kwargs)
add(self, skel, action='add', params=None, **kwargs)
edit(self, skel, action='edit', params=None, **kwargs)
list(self, skellist, action='list', params=None, **kwargs)
editSuccess(self, skel, params=None, **kwargs)
addSuccess(self, skel, 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, 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)