API References

Tools

class pyrmin.tools(config=None)

PyRmin Tool Utility

import pyrmin
pyrmin.tools(self.config)
add_submenu(plugin_names)

Return the child menu of plugin_name

bytes2human(n)

Take bytes and return a human readable string

check_kwargs(args_array)

Return True if all paramaters exists

get_kwargs(arg)

Return Request Parameter for POST and GET method

get_plugin_config(plugin_name=None)

Return Plugin Namespace Configuration

get_session(key)

Return Session Value from Plugin NameSpace

init_html(template_name)

Get Template from plugin directory

save_and_release_session()
Workaround to cleanly release FileSessions in Cherrypy >= 3.3
https://github.com/cherrypy/cherrypy/issues/1316

From https://github.com/devsnd/cherrymusic/issues/483:

> CherryPy >=3.3.0 (up to current version, 3.6) makes it impossible to > explicitly release FileSession locks, because:

> 1. FileSession.save() asserts that the session is locked; and

> 2. _cptools.SessionTool always adds a hook to call sessions.save > before the response is finalized.

> If we still want to release the session in a controller, I guess the > best way to work around this is to remove the hook before the > controller returns:

set_params(key, value)

Set Request Parameter for Distpatch method

set_session(key, value)

Set Session Value in Plugin NameSpace

to_json(dict, origin='*', auth=False)

Return dist as JSON with Access-Control-Allow-Origin Header

tojson(dict, origin='*', auth=False)

Return dist as JSON with Access-Control-Allow-Origin Header

Plugins

class pyrmin.Plugins(config)

Plugin Manager API

get(name)

Return Plugin

install(File, token=None)

Install Plugin Tar gz Archive File or url

list()

Return an array of activated plugins

uninstall(plugin_name)

Uninstall Plugin

update(plugin_name)

Update Plugin dependency

User

class pyrmin.User(config)

pyrmin User ObjectClass if [pyrmin][auth_module] is set and installed get user from auth() plugin

get(user_id=None)

Return Current User Info

gravatar_url(mail)

Return Gravatar url for mail

header_auth(encrypt=None, realm=None)

If an authorization header contains credentials, return True, else False.