Includes Reference
The includes
Module
Collection of functionalities with an includeme() function to be used by the Pyramid configurator or in the INI file.
- chrysalio.includes.load_includes(configurator: Configurator, includes: list | None = None)[source]
Load modules with an includeme() function and fill
configurator.registry['modules']
ordered dictionary.- Parameters:
configurator (pyramid.config.Configurator) – Object used to do configuration declaration within the application.
includes (list) – (optional) List of hard coding includes.
The includes.themes
Module
Theme management.
- chrysalio.includes.themes.includeme(configurator: Configurator)[source]
Function to include themes.
- Parameters:
configurator (pyramid.config.Configurator) – Object used to do configuration declaration within the application.
- chrysalio.includes.themes.load_themes(configurator: Configurator)[source]
Load available themes in registry.
- Parameters:
configurator (pyramid.config.Configurator) – Object used to do configuration declaration within the application.
Set into registry a tuple such as
(default_theme, theme_dict)
wheretheme_dict
is a dictionary like{'theme_id': theme_info…}
.theme_info
is a dictionary with keyspath
,layout
,login
,…
- chrysalio.includes.themes.create_default_theme(configurator: Configurator, package: str)[source]
If the theme management is not activated, it creates a default theme in registry.
- Parameters:
configurator (pyramid.config.Configurator) – Object used to do configuration declaration within the application.
package (str) – Name of the calling package.
- chrysalio.includes.themes.theme_template(request: Request, template_id: str) str | None [source]
Retrieve the absolute file path of the file
template_id
of the current theme.
The includes.cache
Module
Cache functionality.
- chrysalio.includes.cache.includeme(configurator)[source]
Function to include cache functionnality based on registry for global cache and session for user cache.
- Parameters:
configurator (pyramid.config.Configurator) – Object used to do configuration declaration within the application.
- class chrysalio.includes.cache.CacheUser(settings)[source]
Class to manage a private cache for a user based on session.
- set(request, key, value, namespace='', region=None, expire=None)[source]
Set value into the cache.
- Parameters:
request (pyramid.request.Request) – Current request.
key (str) – Key of value to retrieve.
value – The value associated with the key or
None
.namespace (str) – (default=’’) Cache namespace.
region (str) – (optional) Beaker cache region.
expire (int) – (optional) Special expiration.
- get(request, key, namespace='')[source]
Get value from the cache.
- Parameters:
request (pyramid.request.Request) – Current request.
key (str) – Key of value to retrieve.
namespace (str) – (default=’’) Cache namespace.
- Returns:
The value associated with the key or
None
.
- clear(request, key=None, namespace='')[source]
Clear a key/value or the entire namespace
namespace
.- Parameters:
request (pyramid.request.Request) – Current request.
key (str) – (optional) Key of value to remove.
namespace (str) – (default=’’) Cache namespace.
- classmethod purge(request, namespace=None)[source]
Purge expired entries.
- Parameters:
request (pyramid.request.Request) – Current request.
namespace (str) – (optional) Cache namespace.
- chrysalio.includes.cache.cache_user_access(namespace_prefix, region=None)[source]
A decorator to retrieve in the user cache the result of an access method whose the two first arguments are
request
anditem
.item
must have auid
attribute.
- class chrysalio.includes.cache.CacheGlobal(settings)[source]
Class to manage a global cache based on Beaker cache.
- Parameters:
settings (dict) – Pyramid settings.
- chrysalio.includes.cache.cache_global_item(namespace_prefix, region=None, access_function=None)[source]
A decorator to retrieve in the global cache the result of a creation method whose the two first arguments are
request
anditem_id
. The calling class must have a_<item>s
attribute where <item> is the class name in lower case. Ifaccess_function
is notNone
, the access rights are checked.
The includes.clipboard
Module
Clipboard management.
- chrysalio.includes.clipboard.includeme(configurator: Configurator)[source]
Function to include the clipboard.
- Parameters:
configurator (pyramid.config.Configurator) – Object used to do configuration declaration within the application.
Entry for clipboard.
Return the HTML of the button to open the clipboard.
- class chrysalio.includes.clipboard.Clipboard(area: tuple[str, ...] | None = None)[source]
Class to manage clipboard and clipboard panel.
See:
lib.panel.Panel
alias of
NavClipboard
- classmethod register(registry: Registry, panel_class, area: tuple[str, ...] | None = None) Panel | None [source]
Method to register the panel and possibly add it to a navigation menu.
- classmethod is_empty(request: Request) bool [source]
Return
True
if the clipboard is empty.- Parameters:
request (pyramid.request.Request) – Current request.
- Return type:
- classmethod entries(request: Request) list [source]
Return the list of entries.
- Parameters:
request (pyramid.request.Request) – Current request.
- Return type:
- classmethod push(request: Request, domain: str, cut: bool, data, preview: str)[source]
Push a new entry in the clipboard buffer.
- Parameters:
request (pyramid.request.Request) – Current request.
domain (str) – Domain of the entry (ex.:
'warehouse/file'
).cut (bool) –
True
if it is a cut operation.data – Content of this entry. It depends on the domain.
preview (helpers.literal.Literal) – Representation of the entry in the clipboard.
The includes.modules
Module
Modules management.
- chrysalio.includes.modules.includeme(configurator)[source]
Function to include modules functionality.
- Parameters:
configurator (pyramid.config.Configurator) – Object used to do configuration declaration within the application.
The includes.modules.models
Module
SQLAlchemy-powered model definitions for modules.
- class chrysalio.includes.modules.models.DBModule(**kwargs)[source]
SQLAlchemy-powered module class.
- classmethod table4view(request)[source]
Generate the modules table.
- Parameters:
request (pyramid.request.Request) – Current request.
- Return type:
helpers.literal.Literal
- classmethod settings_schema(request)[source]
Return a Colander schema to edit modules.
- Parameters:
request (pyramid.request.Request) – Current request.
- Return type:
- Returns:
A tuple such as
(schema, defaults)
.
- classmethod table4edit(request, form)[source]
Generate the modules table for edition.
- Parameters:
request (pyramid.request.Request) – Current request.
form (.lib.form.Form) – Current form object.
- Return type:
helpers.literal.Literal
The includes.modules.views
Module
View callables.