GitHub-only

WARNING: If you are reading this on GitHub, DON'T! Read the documentation at docs.plone.org so you have working references and proper formatting.

plone.api.env

plone.api.env.adopt_roles(roles=None)

Context manager for temporarily switching roles.

Parameters: roles (list of strings) -- New roles to gain inside block. Existing roles will be lost.
Example: Switch roles inside a block
plone.api.env.adopt_user(username=None, user=None)

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:

Switch user inside a block

plone.api.env.debug_mode()

Returns True if your zope instance is running in debug mode.

Example: Debug mode
plone.api.env.plone_version()

Return Plone version number.

Returns: string denoting what release of Plone this distribution contains
Example: Plone version
plone.api.env.test_mode()

Returns True if you are running the zope test runner.

Example: Test mode
plone.api.env.zope_version()

Return Zope 2 version number.

Returns: string denoting what release of Zope2 this distribution contains
Example: Zope version