plone.api.env
#
Module provides info about your instance and tools to switch roles and user.
- plone.api.env.adopt_roles(roles=None)[source]#
Context manager for temporarily switching roles.
- Parameters:
roles (list of strings) -- New roles to gain inside block. Existing roles will be lost.
- Example:
- plone.api.env.adopt_user(username=None, user=None)[source]#
Context manager for temporarily switching user inside a block.
- Parameters:
user (user object from acl_users.getUser() or api.user.get().) -- User object to switch to inside block.
username (string) -- username of user to switch to inside block.
- Example:
- plone.api.env.debug_mode()[source]#
Return True if your zope instance is running in debug mode.
- Example:
- plone.api.env.plone_version()[source]#
Return Plone version number.
- Returns:
string denoting what release of Plone this distribution contains
- Example:
- plone.api.env.read_only_mode()[source]#
Check if the Zope instance is running on a read-only ZODB.
- Returns:
bool isReadOnly True if ZODB is read-only
- Example: