Tool API Reference¶
Actions Tool¶
These interfaces define the framework used to allow extensible menu actions via the actions tool.
- interface Products.CMFCore.interfaces.IActionProvider¶
Objects that can be queried for actions.
- getActionInfo(action_chain, object=None, check_visibility=False, check_condition=False)¶
Return the first IActionInfo object matching the given criteria.
o If no action is found matching the criteria, raise ValueError.
- o ‘action_chain’ is a sequence of one or more action paths
(e.g. ‘object/view’); each path is formatted as ‘category_id/action_id’. If specified, only matching actions will be returned, and in the given order (paths with no matches are ignored silently).
- o If ‘check_visibility’ is True, return only actions whos “visible”
flag is set.
- o If ‘check_condition’ is True, return only actions whose condition
expression evaluates True.
o Permission: Public
- listActionInfos(action_chain=None, object=None, check_visibility=True, check_permissions=True, check_condition=True, max=None)¶
Return a sequence of IActionInfo objects matching given criteria.
- o ‘action_chain’ is a sequence of one or more action paths
(e.g. ‘object/view’); each path is formatted as ‘category_id/action_id’. If specified, only matching actions will be returned, and in the given order (paths with no matches are ignored silently).
- o If ‘object’ is specified, only actions specific to that object
are included.
- o If ‘check_visibility’ is True, return only actions whos “visible”
flag is set.
- o If ‘check_permissions’ is True, return only actions for whose
permissions the current user is authorized.
- o If ‘check_condition’ is True, return only actions whose condition
expression evaluates True.
o If ‘max’ is specified, return only the first ‘max’ Actions.
o Permission: Public (but not URL-publishable)
- listActions(info=None, object=None)¶
List known actions.
o Return a sequence of action objects.
- o Both the ‘object’ and the ‘info’ arguments are deprecated and
ignored (use ‘listActionInfos’ to filter actions by context).
- interface Products.CMFCore.interfaces.IActionCategory¶
Group of IAction objects and child categories.
- listActions()¶
Return a sequence of IAction objects defined by this category.
o Include actions defined by subcategories.
o Permission: Private (Python only)
- interface Products.CMFCore.interfaces.IAction¶
Specification for an action.
- getInfoData()¶
- Return a lazy mapping of the data needed to create an
IActionInfo object.
o Returned value is actually a tuple, ‘(lazy_map, lazy_keys)’.
- o Default keys are: ‘id’, ‘category’, ‘title’, ‘description’, ‘url’,
‘icon’, ‘available’, ‘permissions’ and ‘visible’.
- o Instead of computed values callable expression objects or methods
are returned. For performance reasons, these objects are called later and only if the values are actually needed. The keys for all these lazy values are registered in a separate list.
- interface Products.CMFCore.interfaces.IActionInfo¶
A lazy dictionary for Action infos.
o Each ActionInfo object has the following keys:
id (string): not unique identifier
title (string)
url (string): URL to access the action
category (string): one of “user”, “folder”, “object”, “global”, “workflow” or a custom category
visible (boolean)
available (boolean): the result of checking the condition
allowed (boolean): the result of checking permissions; The user must have at least one of the listed permissions to access the action. If the list is empty, the user is allowed.
- interface Products.CMFCore.interfaces.IActionsTool¶
Generate the list of “actions” which the user is allowed to perform.
- o Synthesize this list from the actions managed by a set of “action
providers”.
- addActionProvider(provider_name)¶
Register an IActionProvider to the set queried by this tool.
- o ‘provider_name’ is appended to the set of names already registered
with the tool.
- o Raise ComponentLookupError if no utility of that name is registered
for IActionProvider.
- o Deprecated: In the future, expect to use ‘getUtilitiesFor’ instead
(presuming either that ordering either doesn’t matter or that ordering is supported by the utility registry).
o Permission: Manage portal
- deleteActionProvider(provider_name)¶
Remove an IActionProvider from the set queried by this tool.
- o Return silently if ‘provider_name’ is not already registered with
the tool.
- o Deprecated: In the future, expect to use ‘getUtilitiesFor’ instead
(presuming either that ordering either doesn’t matter or that ordering is supported by the utility registry).
o Permission: Manage portal
- id¶
The ID of the tool.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘getUtility(IActionsTool)’.
o Must be set to “portal_actions”
- listActionProviders()¶
- Return a sequence of names of all IActionProvider utilities
registered with this tool.
- o The returned list of names will be a subset of the set available
via ‘getUtilitiesFor(IActionProvider)’ (which returns ‘(name, value)’ tuples).
- o Deprecated: In the future, expect to use ‘getUtilitiesFor’ instead
(presuming either that ordering either doesn’t matter or that ordering is supported by the utility registry).
o Permission: Manage portal
- listFilteredActionsFor(object=None)¶
Map actions available to the user by category.
- o Returned mapping will have category IDs as keys, and sequences
of IActionInfo objects as the corresponding values for each category.
o Categories may be arbitrarily extended.
o Permission: Public
Caching Policy Manager¶
These interfaces define the framework used by the cache policy manager tool to set caching headers on content views.
- interface Products.CMFCore.interfaces.ICachingPolicy¶
- getETagFunc()¶
- getEnable304s()¶
- getHeaders(expr_context)¶
Does this request match our predicate?
If so, return a sequence of caching headers as (key, value) tuples. Otherwise, return an empty sequence.
- getLastModified()¶
Should we set the last modified header?
- getMTimeFunc()¶
- getMaxAgeSecs()¶
- getMustRevalidate()¶
- getNoCache()¶
- getNoStore()¶
- getNoTransform()¶
- getPolicyId()¶
- getPostCheck()¶
- getPreCheck()¶
- getPredicate()¶
- getPrivate()¶
- getProxyRevalidate()¶
- getPublic()¶
- getSMaxAgeSecs()¶
- getVary()¶
- testPredicate(expr_context)¶
Does this request match our predicate?
- interface Products.CMFCore.interfaces.ICachingPolicyManager¶
Compute HTTP cache headers for skin methods.
- getHTTPCachingHeaders(content, view_method, keywords, time=None)¶
Update HTTP caching headers in REQUEST
o ‘content’ is the content object being published.
o ‘view_method’ is the name of the view being published
o ‘keywords’ is a set of extra keywords modifying the view.
- o If ‘time’ is supplied, use it instead of the current time
(for reliable testing).
- id¶
The ID of the tool.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘queryUtility(ICachingPolicyManager)’.
o Must be set to ‘caching_policy_manager’.
Catalog Tool¶
These interfaces define the framework used by the catalog tool to index and search content. See also the interfaces for Searchable Content.
- interface Products.CMFCore.interfaces.IIndexableObject¶
Marker interface for objects that can be indexed in the portal catalog
- interface Products.CMFCore.interfaces.IIndexableObjectWrapper¶
Wrapper for catalogued objects, for indexing “virtual” attributes.
- allowedRolesAndUsers()¶
Return a sequence roles and users with View permission.
- o PortalCatalog indexes this sequence to allow filtering out items
a user is not allowed to see.
- interface Products.CMFCore.interfaces.ICatalogTool¶
Wrap the “stock” ZCatalog with custom behavior for the CMF.
- __call__(REQUEST=None, **kw)¶
Alias for searchResults().
- id¶
Must be set to “portal_catalog”
- indexObject(object)¶
Add ‘object’ to the catalog.
o Permission: Private (Python only)
- reindexObject(object, idxs=[], update_metadata=True)¶
Update ‘object’ in catalog.
- o ‘idxs’, if passed, is a list of specific indexes to update
(by default, all indexes are updated).
- o If ‘update_metadata’ is True, then update the metadata record
in the catalog as well.
o Permission: Private (Python only)
- searchResults(REQUEST=None, **kw)¶
Decorate ZCatalog.searchResults() with extra arguments
- o The extra arguments that the results to what the user would be
allowed to see.
- unindexObject(object)¶
Remove ‘object’ from the catalog.
o Permission: Private (Python only)
- unrestrictedSearchResults(REQUEST=None, **kw)¶
Calls ZCatalog.searchResults() without any CMF-specific processing.
o Permission: Private (Python only)
Content Type Registry¶
These interfaces define the framework used by the content type registry tool to determine what kind of content object to create based on a MIME type or filename. This lookup is done when adding new items to Content Containers via FTP or WebDAV.
- interface Products.CMFCore.interfaces.IContentTypeRegistryPredicate¶
Match a given name/typ/body to a portal type.
The registry will call the predictate’s ‘edit’ method, passing the fields of the record.
- __call__(name, typ, body)¶
Return true if the rule matches, else false.
- getTypeLabel()¶
Return a human-readable label for the predicate type.
- predicateWidget()¶
Return a snippet of HTML suitable for editing the predicate.
- o This method may be defined via DTMLFile or PageTemplateFile
(the tool will call it appropriately, if it is DTML).
- o The snippet should arrange for values to be marshalled by
ZPublisher as a ‘:record’, with the ID of the predicate as the name of the record.
- interface Products.CMFCore.interfaces.IContentTypeRegistry¶
Apply policy mapping PUT arguments to a CMF portal type.
- findTypeName(name, typ, body)¶
Return the the portal type (an ID) for a PUT request.
- o ‘name’ is the filename supplied as the end of the path of the
PUT request.
- o ‘typ’ is the MIME type for the request (which may have been guessed
already from the extension or the body).
o ‘body’ is the actual payload of the PUT request.
o Return None if no match found.
Discussion Tool¶
These interfaces define the framework used by the discussion tool to determine whether discussion is allowed for particular content objects. See also Discussable Content.
- interface Products.CMFCore.interfaces.IOldstyleDiscussionTool¶
Links content to discussions.
- getDiscussionFor(content)¶
Return an IDiscussionItemContainer for ‘content’.
o Create the IDC if necessary.
o Raise ValueError if discussion is not allowed on ‘content’.
o Permission: Public
- id¶
The tool’s ID.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘queryUtility(IDiscussionTool)’.
o Must be set to ‘portal_discussion’.
- isDiscussionAllowedFor(content)¶
Return True discussion is allowed for ‘content’, else False.
- o Result may be looked up from an object-specific value, or by place,
or from a site-wide policy.
o Permission: Public
- interface Products.CMFCore.interfaces.IDiscussionTool¶
Extends:
Products.CMFCore.interfaces.IOldstyleDiscussionTool
Links content to discussions.
- overrideDiscussionFor(content, allowDiscussion)¶
Override discussability for the given object or clear the setting.
o ‘allowDiscussion’ may be True, False, or None.
- o If ‘allowDiscussion’ is None, then clear any overridden setting for
discussability, letting the site’s default policy apply.
o Otherwise, set the override to match ‘allowDiscussion’.
o Permission: PUblic ???? Should be ManageContent, or something.
MemberData Tool¶
These interfaces define the framework used by the membedata tool for storing and querying information about a registered member.
- interface Products.CMFCore.interfaces.IMemberData¶
MemberData interface.
- setProperties(properties=None, **kw)¶
Allow the authenticated member to update his/her member data.
- o ‘properties’, if passed, is a mapping of the IDs and values of
the properties to be changed.
- o The method may also be invoked via keyword arguments (in this
case, do not pass ‘properties’).
o Permission: Set own properties
- interface Products.CMFCore.interfaces.IMemberDataTool¶
Decorate user objects with site-local data.
- deleteMemberData(member_id)¶
Delete member data of specified member.
o Return True if a record was deleted, else False.
o Permission: Private (Python only)
- getMemberDataContents()¶
Returns a list containing a dictionary with information about the _members BTree contents
- o The key ‘member_count’ is the total number of member instances
stored in the memberdata-tool
- o The key ‘orphan_count’ is the number of member instances
that for are no longer in the underlying acl_users user folder.
o The result is designed to be iterated over in a dtml-in
o ???: why a sequence?
o Permission: Private (Python-only)
- id¶
The tool’s ID.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘queryUtility(IMemberDataTool)’.
o Must be set to ‘portal_memberdata’
- pruneMemberDataContents()¶
Delete member data of all members not findable in acl_users.
- o Compare the user IDs stored in the member data tool with the
list in the actual underlying acl_users and delete any records whose user cannot be found.
o Permission: Private (Python only)
- registerMemberData(m, id)¶
Add the given member data to the _members btree.
o ‘m’ is an object whose attributes are the memberdata for the member.
o ‘id’ is the userid of the member.
- o Add the record late as possible to avoid side effect transactions
and to reduce the necessary number of entries.
- o ???: these argument names are silly; can we use more sensible
ones (i.e., does anyone actually depend on them)?
o Permission: Private (Python only)
- searchMemberData(search_param, search_term, attributes=())¶
Return a sequence of mappings of memberdata for the given criteria.
o ‘search_param’ is the property ID to be searched.
o ‘search_term’ is the property value to be searched.
- o ‘attributes’, if passed, controls the keys in the returned mappings;
by default the returned keys are ‘username’ and ‘email’.
- o ???: that default is silly; if it is truly needed, then it should
be the default value of the ‘attributes’ argument.
o Permission: Private (Python only)
- wrapUser(user)¶
Returns an IMember instance for the given user object.
o Permission: Private (Python-only)
Membership Tool¶
This interface defines the API provided by the membership tool for finding site-wide information about a registered member.
- interface Products.CMFCore.interfaces.IMembershipTool¶
Manage policy of how and where to store and retrieve members and their member folders.
- addMember(id, password, roles, domains)¶
Adds a new member to the user folder.
- o Security checks will have already been performed. Called by
the registration tool.
Permission: Private (Python only)
- checkPermission(permissionName, object, subobjectName=None)¶
- Return True if the current user has the given permission on
the given object or subobject.
o ‘permissionName’ is the string identifying the permission.
o ‘object’ is the object being checked.
- o ‘subobjectName’, if passed, is the attribute name to be checked;
if None, test the main object itself.
o Permission: Public
- createMemberArea(member_id='')¶
Return a member area for the given member, creating if necessary.
o If member area creation is disabled, return None.
- o ‘member_id’, if passed, is the ID of the member whose folder is
to be created; if not passed, default to the authenticated member.
o Permission: Public # ????
- credentialsChanged(password, REQUEST=None)¶
- Notify the authentication mechanism that this user has
changed passwords.
- o The authentication mechanism can use this notification to update
the authentication cookie.
- o Note that this call should not cause any change at all to user
databases.
o ???: should be an event.
- o ???: should this be in scope for this tool? Or should it be
done by the view class for the password update view?
Permission: Public # ????
- deleteLocalRoles(obj, member_ids, reindex=True, recursive=False)¶
Remove local roles of specified members from an object.
o ‘obj’ is the object on which to remove the role.
o ‘member_ids’ is a sequence of user IDs from which to remove the role.
- o If ‘reindex’ is True, then reindex the security-related attributes
of the object and all subobjects.
o if ‘recursive’ is True, recurse over all subobjects of ‘object’.
- o Raise Unauthorized if the currently-authenticated member cannot
assign ‘member_role’ on ‘obj’.
Permission: Public
- deleteMemberArea(member_id)¶
Delete member area of specified member
o Return True if a member area previously existed for the member.
o ‘member_id’ identifies the member whose member is to be removed.
o Permission: Manage users
- deleteMembers(member_ids, delete_memberareas=1, delete_localroles=1)¶
Remove specified members from the site.
o Returns a sequence of member_ids of members actually deleted.
o Remove the members from the user folder.
o ‘member_ids’ is a sequence of one or more user IDs to remove.
o Remove corresponding member data in the memberdata tool.
- o If ‘delete_memberareas’ is True, delete members’ home folders
including all content items.
- o If ‘delete_localroles’ is true, recursively delete members’ local
roles, starting from the site root.
o Permission: Manage users
- getAuthenticatedMember()¶
Return the currently authenticated member object
- o If no valid credentials are passed in the request, return
the Anonymous User.
o Permission: Public
- getCandidateLocalRoles(obj)¶
- Return a sequence local roles assignable by the current user for
a given object.
o ‘obj’ is the object to which role assignments may be made.
o Permission: Public # ????
- getHomeFolder(id=None, verifyPermission=False)¶
Return a member’s home folder object or None.
- o ‘id’, if passed, is the ID of the member whose folder should be
returned; if not passed, use the currently-authenticated member.
- o If ‘verifyPermission’ is True, return None when the user
doesn’t have the View permission on the folder.
o Permission: Public
- getHomeUrl(id=None, verifyPermission=0)¶
Return the URL to a member’s home folder or None.
- o ‘id’, if passed, is the ID of the member whose folder should be
returned; if not passed, use the currently-authenticated member.
- o If ‘verifyPermission’ is True, return None when the user
doesn’t have the View permission on the folder.
Permission: Public
- getMappedRole(portal_role)¶
- Returns a mapped role name corresponding to ‘portal_role’, or
the empty string if no mapping exists.
o Mappings are defined via ‘setRoleMapping’.
o Permission: Manage portal
- getMemberById(id)¶
Returns the IMember instance corresponding to the given id.
o Permission: Manage users
- getMemberareaCreationFlag()¶
- Return True if the membership tool will create a member area for
a user at login.
o Permission: Manage portal
- getMembersFolder()¶
Return the folderish object which contains membmer folders.
- o Return None if no members folder is set or if the specified
folder doesn’t exist.
o Permission: Public
- getPortalRoles()¶
Return a sequence of role names defined by the portal itself.
o Returned role names are those understood by the portal object.
o Permission: Manage portal
- id¶
The tool’s ID.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘getUtility(IMembershipTool)’.
o Must be set to ‘portal_membership’.
- isAnonymousUser()¶
Return True if no valid credentials are passed in the requeset.
o Permission: Public
- isMemberAccessAllowed(member_id)¶
Check if the authenticated user is this member or an user manager.
If you don’t have the ‘Manage users’ permission for the membership tool, you shouldn’t have write access to other members.
- listMemberIds()¶
Return a sequence of ids of all members.
- o This may eventually be replaced with a set of methods for querying
pieces of the list rather than the entire list at once.
o Permission: Manage users
- listMembers()¶
Return a sequence of all IMember instances.
- o This may eventually be replaced with a set of methods for querying
pieces of the list rather than the entire list at once.
o Permission: Manage users
- setLocalRoles(obj, member_ids, member_role, reindex=True)¶
Assign a local role on an item to one or more members.
o ‘obj’ is the object on which to assign the role.
o ‘member_ids’ is a sequence of user IDs to which to assign the role.
o ‘member_role’ is the name of the role to assign.
- o If ‘reindex’ is True, then reindex the security-related attributes
of the object and all subobjects.
- o Raise Unauthorized if the currently-authenticated member cannot
assign ‘member_role’ on ‘obj’.
o Permission: Public # ????
- setMemberareaCreationFlag()¶
Toggle the policy flag for create a member areas at login.
- o ???: Toggle is a weak semantic here; shouldn’t we be passing
the value we want the flag to have?
o Permission: Manage portal
- setPassword(password, domains=None)¶
Allow the authenticated member to set his/her own password.
Permission: Set own password
- setRoleMapping(portal_role, userfolder_role)¶
- Register a mapping of a role defined by the portal to a role
coming from outside user sources.
o Permission: Manage portal
Metadata Tool¶
This interface defines the API provided by the metadata tool for managing / querying policies about content metadata.
- interface Products.CMFCore.interfaces.IMetadataTool¶
CMF metadata policies interface.
- addSchema(schema_id)¶
Create a new schema with the given ID.
o Return the newly-created schema object.
o Raise KeyError if such a schema already exists.
- getFullName(userid)¶
Convert an internal userid to a “formal” name.
- o Convert only if possible, perhaps using the ‘portal_membership’
tool; otherwise, return ‘userid’.
o Used to map userid’s for Creator, Contributor DCMI queries.
- getPublisher()¶
Return the “formal” name of the publisher of the site.
- id¶
The tool’s ID.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘queryUtility(IMetadataTool)’.
o Must be set to ‘portal_metadata’.
- listAllowedFormats(content=None, content_type=None)¶
List the allowed values of the ‘Format’ DCMI element.
o These items should be usable as HTTP ‘Content-type’ values.
- o Return only values appropriate for content’s type, or all values if
both ‘content’ and ‘content_type’ are None.
- listAllowedLanguages(content=None, content_type=None)¶
List the allowed values of the ‘Language’ DCMI element.
- o ‘Language’ element values should be suitable for generating
HTTP headers.
- o Return only values appropriate for content’s type, or all values if
both ‘content’ and ‘content_type’ are None.
- listAllowedRights(content=None, content_type=None)¶
List the allowed values of the ‘Rights’ DCMI element.
- o The ‘Rights’ element describes copyright or other IP declarations
pertaining to a resource.
- o Return only values appropriate for content’s type, or all values if
both ‘content’ and ‘content_type’ are None.
- listAllowedSubjects(content=None, content_type=None)¶
List the allowed values of the ‘Subject’ DCMI element.
o ‘Subject’ elements should be keywords categorizing their resource.
- o Return only values appropriate for content’s type, or all values if
both ‘content’ and ‘content_type’ are None.
- listAllowedVocabulary(schema, element, content=None, content_type=None)¶
List allowed values for a given schema element and content object.
o List possible keywords if both ‘content’ and ‘content_type’ are None.
- listSchemas()¶
Return a list of (id, schema) tuples enumerating our schema.
- removeSchema(schema_id)¶
Remove an existing schema with the given ID.
o Raise KeyError if no such schema exists.
- setInitialMetadata(content)¶
Set initial values for content metatdata.
o Supply any site-specific defaults.
- validateMetadata(content)¶
Enforce portal-wide policies about metadata.
o E.g., policies may require non-empty title/description, etc.
- o This method may be called by view / workflow code at “appropriate”
times, such as immediately before saving changes to the metadata of an object.
Properties Tool¶
This interface defines the API provided by the properties tool for querying site-wide properties.
- interface Products.CMFCore.interfaces.IPropertiesTool¶
Manage properties of the site as a whole.
- editProperties(props)¶
Change portal settings.
o ‘props’ is a mapping of values to be updates.
o Permission: Manage portal
- id¶
The tool’s ID.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘getUtility(IPropertiesTool)’.
o Must be set to ‘portal_properties’.
- smtp_server()¶
Return the configured SMTP server for the site.
- title()¶
Return the site’s title.
Registration Tool¶
These interfaces define the framework used by the registration tool for managing policies about how users join the site.
- interface Products.CMFCore.interfaces.IRegistrationTool¶
Manage policies for member registration.
o Depends on IMembershipTool component.
o Is not aware of membership storage details.
- addMember(id, password, roles=('Member',), domains='', properties=None)¶
Creates and return a new member.
- o ‘id’ is the user ID of the member to be created; raise ValueError
if there already exists a member with the given ‘id’.
- o ‘password’ is the user’s password; raise ValueError if the
supplied ‘password’ does not comply with the site’s password policy.
- o ‘roles’ is a list of roles to grant the new member; raise
Unauthorized if the currently-authenticated user is not allowed to grant one of the roles listed
“Member” is a special role that can always be granted
- o ‘properties’, if passed, is a mapping with additional member
properties; raise ValueError if one or more properties do not comply with the site’s policies.
o Permission: Add portal member
- afterAdd(member, id, password, properties)¶
- Notification called by portal_registration.addMember() after a
member has been added successfully.
o Permission: Private (Python only)
- generatePassword()¶
- Return a generated password which is complies with the site’s
password policy.
o Permission: Public
- id¶
The ID of the tool.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘queryUtility(IRegistrationTool)’.
o Must be set to “portal_registration”
- isMemberIdAllowed(id)¶
- Return True if ‘id’ is not in use as a member ID and is not
reserved, else False.
o Permission: Add portal member
- isRegistrationAllowed(REQUEST)¶
- Return True if the current user is allowed to add a member to
the site, else False.
o Permission: Public
- mailPassword(forgotten_userid, REQUEST)¶
Email a forgotten password to a member.
o Raise ValueError if user ID is not found.
o ???: should probably not raise, in order to prevent cracking.
o Permission: Mail forgotten password
- testPasswordValidity(password, confirm=None)¶
- Return None if the password is valid; otherwise return a string
explaining why not.
o ‘password’ is the candidate password string.
o If ‘confirm’ is passed, ????
o Permission: Public
- testPropertiesValidity(new_properties, member=None)¶
- Return None if the supplied properties are valid; otherwise
return a string explaining why not.
o ‘new_properties’ is a mapping containing the properties to test.
- o ‘member’, if passed, is the ID of the member for whome the
properties are being set; if not passed, use the currently- authenticated member.
o Permission: Public
Skins Tool¶
These interfaces define the framework used by the skins tool for layering UI components to create “skins” for the site.
- interface Products.CMFCore.interfaces.IDirectoryView¶
Directory views mount filesystem directories.
- interface Products.CMFCore.interfaces.ISkinsContainer¶
An object that provides skins.
- getDefaultSkin()¶
Return the default skin name.
o Permission: Access contents information
- getRequestVarname()¶
Return the variable name to look for in the REQUEST.
o Permission: Access contents information
- getSkinByName(name)¶
Get the named skin.
Permission: Private (Python only)
- getSkinByPath(path, raise_exc=0)¶
Return a skin at the given path.
o ???: what are we doing here?
- o A skin path is a search path of layers of the format:
‘some/path, some/other/path, …’.
o Attributes are looked up in the layers in the named order.
- o A skin is a specially wrapped object that looks through the layers
in the correct order.
o Permission: Private (Python only)
- getSkinPath(name)¶
Convert a skin name to a skin path.
o Permission: Access contents information
- interface Products.CMFCore.interfaces.ISkinsTool¶
Extends:
Products.CMFCore.interfaces.ISkinsContainer
An object that provides skins to a portal object.
O ???: This shouldn’t derive from ISkinsContainer?
- getSkinSelections()¶
Get the sorted list of available skin names.
o Permission: Public
- id¶
The ID of the tool.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘queryUtility(ISkinsTool)’.
o Must be set to ‘portal_skins’.
Types Tool¶
These interfaces define the framework used by the skins type for defining extensible content object types.
- interface Products.CMFCore.interfaces.ITypeInformation¶
Type definition interface.
- Description()¶
Return a textual description of the type
o This descriptoin is used for display in a “constructor list”.
- Metatype()¶
Return the Zope ‘meta_type’ for this content object.
- o Deprecated (not all objects of a given type may even share
the same meta_type).
- Title()¶
Return the “human readable” type name
- o Note that it may not map exactly to the ‘meta_type’, e.g.,
for l10n/i18n or where a single content class is being used twice, under different names.
- allowDiscussion()¶
- Return True if objects of this type are allowed to support
discussion, else False.
o Individual objects may still disable discussion.
- allowType(contentType)¶
Can objects of ‘contentType’ be added to containers of our type?
- constructInstance(container, id)¶
Build a “bare” instance of the appropriate type in ‘container’.
o Give the new instance an ID of ‘id’.
o Return the newly-created instance, seated in ‘container’.
- getIconExprObject()¶
Get the expression object representing the icon for this type.
- getMethodAliases()¶
Return a mapping of method aliases for this type.
o ???: define keys and values of the mapping.
o Permission: Manage portal
- isConstructionAllowed(container)¶
Return True if the current user is allowed to construct an instance of this type in ‘container, else False.
- queryMethodID(alias, default=None, context=None)¶
Return the method ID for a given alias.
- o ‘context’, if passed, points to the object calling this method.
It may be used to return dynamic values based on the caller. ???: this is unclear
o ‘default’ is returned if no such alias is defined.
o Permission: Public
Returns: Method ID or default value
- setMethodAliases(aliases)¶
Assign method aliases for this type.
o Return True if the operation changed any aliases, else False.
o ‘aliases’ is the mapping of aliases to be assigned.
o ???: define keys and values of the mapping.
o Permission: Manage portal
- interface Products.CMFCore.interfaces.ITypesTool¶
Register content types for the site.
- constructContent(contentType, container, id, RESPONSE=None, *args, **kw)¶
Build an instance of the appropriate type in ‘container’
- o ‘contentType’ is the name of the ITypeInformation to be
constructed.
o Assign the instance the given ‘id’, if possible.
- o If ‘RESPONSE’ is passed, redirect to the new object’s
“initial view”; otherwise return the new object’s ‘id’ (which may have morphed during construction).
- o Raise Unauthorized if the current user is not allowed to construct
items of the given type in ‘container’.
- getTypeInfo(contentType)¶
Return an ITypeInformation for the given type name / object.
- o If ‘contentType’ is actually an object, rather than a string,
attempt to look up the appropriate type info using its ‘portal_type’.
o Permission: Public
- id¶
The ID of the tool.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘getUtility(ITypesTool)’.
o Must be set to “portal_types”
- listContentTypes(container=None, by_metatype=0)¶
- Return a sequence of IDs of ITypeInformations registered
for the site.
- o If ‘by_metatype’ is True, return meta_types instead (this variant
is deprecated).
- o If ‘container’ is passed, filter the list according to the user’s
permissions to add content in that place.
o Permission: Public
- listTypeInfo(container=None)¶
- Return a sequence of ITypeInformations registered for the
site.
- o If ‘container’ is passed, filter the list according to the user’s
permissions to add content in that place.
o Permission: Public
Undo Tool¶
This interface defines the API provided undo tool for undoing changes made to the site.
- interface Products.CMFCore.interfaces.IUndoTool¶
Provide access to Zope undo functions.
- id¶
The ID of the tool.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘queryUtility(IUndoTool)’.
o Must be set to “portal_undo”
- listUndoableTransactionsFor(object, first_transaction=None, last_transaction=None, PrincipiaUndoBatchSize=None)¶
List all transaction IDs the user is allowed to undo on ‘object’.
- o Return a list of “transaction info” objects, using the given
parameters to batch the results.
o ???: this needs documentation / testing.
o Permission: Undo changes
- undo(object, transaction_info)¶
Performs an undo operation.
o Permission: Undo changes
URL Tool¶
This interfaces defines the API provided by the url tool for generating and resolving URLs and paths relative to the site root.
- interface Products.CMFCore.interfaces.IUndoTool¶
Provide access to Zope undo functions.
- id¶
The ID of the tool.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘queryUtility(IUndoTool)’.
o Must be set to “portal_undo”
- listUndoableTransactionsFor(object, first_transaction=None, last_transaction=None, PrincipiaUndoBatchSize=None)¶
List all transaction IDs the user is allowed to undo on ‘object’.
- o Return a list of “transaction info” objects, using the given
parameters to batch the results.
o ???: this needs documentation / testing.
o Permission: Undo changes
- undo(object, transaction_info)¶
Performs an undo operation.
o Permission: Undo changes
Workflow Tool¶
These interfaces define the framework used by the workflow type for defining configurable workflows for content types. See also Content Workflow.
- interface Products.CMFCore.interfaces.IWorkflowDefinition¶
Plugin interface for workflow definitions managed by IWorkflowTool.
- doActionFor(ob, action, comment='')¶
Perform the requested workflow action on a content object.
o ‘ob’ is the content object.
o ‘action’ is the ID of the requested workflow action.
o ‘comment’ is passed to the method corresponding to ‘action’.
o Invoked by the portal_workflow tool.
o Allows the user to request a workflow action.
o This method must perform its own security checks.
o Permission: Private (Python only)
- getCatalogVariablesFor(ob)¶
Return a mapping of attributes relevant to this workflow.
o Invoked by the workflow tool.
- o Allows workflows to add variables to the catalog based on workflow
status, making it possible to implement queues.
o Permission: Private (Python only)
- getId()¶
Return the id of the workflow definition.
- getInfoFor(ob, name, default)¶
Return the requested workflow information for a content object.
o ‘ob’ is the content object.
o ‘name’ is the name of the requested workflow information.
o ‘default’ is returned if ‘name’ is not found.
o Invoked by the portal_workflow tool.
o This method must perform its own security checks.
o Permission: Private (Python only)
- isActionSupported(ob, action, **kw)¶
- Return True if the given workflow action is supported by this
workfow for a content object, else False.
o ‘ob’ is the content object.
o ‘action’ is the ID of the requested workflow action.
o Invoked by the portal_workflow tool.
o Permission: Private (Python only)
- isInfoSupported(ob, name)¶
- Return True if the given info name is supported by this workflow
for a given content object, else False.
o ‘ob’ is the content object.
o ‘name’ is the name of the requested workflow information.
o Invoked by the portal_workflow tool.
o Permission: Private (Python only)
- listGlobalActions(info)¶
Return a sequence of workflow action objects.
o ‘info’ is an OAI (ObjectActionInformation ?) structure.
- o Returned actions are “global”, i.e. relevant to the user and the
site, rather than to any particular content object (this method is generally called on every request!)
o Invoked by the portal_workflow tool.
o Permission: Private (Python only)
- listObjectActions(info)¶
Return a sequence of workflow action objects.
o ‘info’ is an OAI (ObjectActionInformation ?) structure.
- o Returned actions are relevant to ‘info.content’ (this method is
called only when this workflow is applicable to ‘info.content’).
o Invoked by the portal_workflow tool.
o Permission: Private (Python only)
- notifyBefore(ob, action)¶
Notification of a workflow action before it happens.
o ‘ob’ is the target object of the action.
- o ‘action’ is a string identifying the impending action;
usually it corresponds to a method name.
o This workflow may veto by raising WorkflowException.
- o Unless some workflow raises WorkflowException is thrown,
the workflow tool will emit either ‘notifySuccess’ or ‘notifyException’ after the action.
o Invoked by the portal_workflow tool.
o Permission: Private (Python only)
- notifyCreated(ob)¶
Notification that an object has been created and put in its place.
o ‘ob’ is the newly-created object.
o Invoked by the portal_workflow tool.
- o The workflow may set initial workflow state, etc. for the new
object.
o Permission: Private (Python only)
- notifyException(ob, action, exc)¶
Notifies this workflow that an action failed.
o ‘ob’ is the target object of the action.
- o ‘action’ is a string identifying the failed action;
usually it corresponds to a method name.
o ‘exc’ is the ‘sys.exc_info’ triple for the exception.
o Invoked by the portal_workflow tool.
o Permission: Private (Python only)
- notifySuccess(ob, action, result)¶
Notification that a workflow action has taken place.
o ‘ob’ is the target object of the action.
- o ‘action’ is a string identifying the succesful action;
usually it corresponds to a method name.
o ‘result’ is the return value from the method called.
o Invoked by the portal_workflow tool.
o Permission: Private (Python only)
- updateRoleMappingsFor(ob)¶
- Update the object permissions according to the current workflow
state of ‘ob’.
- o Note that having the same permission(s) controlled by more than one
workflow defintiion for an object results in undefined behavior.
o Permission: Private (Python only)
- interface Products.CMFCore.interfaces.IWorkflowTool¶
This tool accesses and changes the workflow state of content.
- doActionFor(ob, action, wf_id=None, *args, **kw)¶
Perform the given workflow action on ‘ob’.
o ‘ob’ is the target object.
o ‘action’ is the ID of the action to perform.
o ‘wf_id’, if passed, is the ID of the workflow supplying the action.
o ‘args’ and ‘kw’, if passed, are applied to the invoked action.
- o Invoked by user interface code, allowing the user to request a
workflow action.
o The workflow object must perform its own security checks.
o Permission: Public
- getCatalogVariablesFor(ob)¶
Get a mapping of “workflow-relevant” attributes.
o Invoked by ‘portal_catalog’ when indexing content.
- o Allows workflows to add variables to the catalog based on workflow
status, making it possible to implement queues.
o Permission: Private (Python only)
- getHistoryOf(wf_id, ob)¶
Get the history of an object for a given workflow.
o ‘wf_id’ is the id of the selected workflow.
o ‘ob’ is the content object.
o Invoked by workflow definitions.
o Permission: Private (Python only)
- getInfoFor(ob, name, default=<object object at 0x7f801909ece0>, wf_id=None)¶
Get the given bit of workflow information for the object.
o ‘ob’ is the target object.
o ‘name’ is the name of the information requested.
- o ‘default’, if passed, will be returned if ‘name’ is not found;
if ‘default’ is not passed, then raise ValueError.
o ‘wf_id’, if passed, is the ID of the workflow supplying the action.
- o Invoked by user interface code, allowing the user to request
information provided by the workflow.
o The workflow object must perform its own security checks.
o Permission: Public
- getStatusOf(wf_id, ob)¶
Get the last element of a workflow history for a given workflow.
o ‘wf_id’ is the id of the selected workflow.
o ‘ob’ is the content object.
o Invoked by workflow definitions.
o Permission: Private (Python only)
- id¶
The ID of the tool.
- o BBB: for use in ‘getToolByName’; in the future, prefer
‘queryUtility(IWorkflowTool)’.
o Must be set to “portal_workflow”
- notifyBefore(ob, action)¶
Notify all applicable workflows of an action before it happens.
o ‘ob’ is the content object which is the target of the action.
o ‘action’ usually corresponds to a method name.
- o Participating workflows may veto the action by raising
WorkflowException.
- o Unless vetoed, the tool will later call either a ‘notifySuccess’ or
‘notifyException’
o Permission: Private (Python only)
- notifyCreated(ob)¶
Notify all applicable workflows that an object has been created.
- o ‘ob’ is the newly-created object; it will already be “seated”
in its new place.
o Permission: Private (Python only)
- notifyException(ob, action, exc)¶
Notify all applicable workflows that an action failed.
o ‘ob’ is the content object which is the target of the action.
o ‘action’ usually corresponds to a method name.
o ‘exc’ is the ‘sys.exec_info’ triple for the exception.
o Permission: Private (Python only)
- notifySuccess(ob, action, result=None)¶
Notify all applicable workflows that an action has taken place.
o ‘ob’ is the content object which is the target of the action.
o ‘action’ usually corresponds to a method name.
o ‘result’ is the value returned from the action.
o Permission: Private (Python only)
- setStatusOf(wf_id, ob, status)¶
Append a record to the workflow history of a given workflow.
o ‘wf_id’ is the id of the selected workflow.
o ‘ob’ is the content object.
o ‘status’ is a mapping defining the history item to append.
o Invoked by workflow definitions.
o Permission: Private (Python only)
- interface Products.CMFCore.interfaces.IConfigurableWorkflowTool¶
Extends:
Products.CMFCore.interfaces.IWorkflowTool
Manage workflow tool settings.
- getChainFor(ob)¶
Get the chain that applies to the given object.
o If ‘ob’ is a string, it is used as portal type name.
o Permission: Private (Python only)
- getDefaultChain()¶
Get the default chain for this tool.
o Permission: Private (Python only)
- listChainOverrides()¶
List portal type specific chain overrides.
o Permission: Private (Python only)
- setChainForPortalTypes(pt_names, chain, verify=True)¶
Set a chain for specific portal types.
- o If chain is None, set the chain for the portal types to be the
default chain.
o Permission: Manage portal
- setDefaultChain(default_chain)¶
Set the default chain for this tool.
o Permission: Manage portal