ptah.cms

Content classes

class ptah.cms.Node(**kw)

Base class for persistent objects.

__uri__

Unique object id. Required

__type__

Type information object ptah.cms.TypeInformation

__parent__

Parent of node. Ptah doesn’t load __parent__ automatically. To load node parents use ptah.cms.load_parents() function.

__owner__

URI of owner principal. It possible to load principal object by using ptah.resolve() function.

__local_roles__

ptah.JsonDictType which contains a principal uri as a key and a sequence of role’s granted to principal for Node.

__acls__

a ptah.JsonListType of ptah.ACL strings registered with security machinery.

__annotations__

a dictionary which contains strings arbitrary annotations data.

__uri_factory__

function which will return value for __uri__. the uri must be resolvable by using ptah.resolve() function.

class ptah.cms.BaseContent(**kw)

Base class for content objects. A content class should inherit from Content to participate in content hierarchy traversal.

__path__

A string used by the ptah.cms.ContentTraverser which is used for efficient resolution of URL structure to content models. This is internal implementation and manually editing it can break your hierarchy.

__name__

This is the identifier in a container if you are using containment and hierarchies.

title

Content title which is editable by end user.

description

Content description which is editable by end user.

created

Content creation time which is set by ptah.cms.content.createdHandler() during object creation.

Type :datetime.datetime
modified

Content modification time which is set by ptah.cms.content.modifiedHandler() during object modification.

Type :datetime.datetime
effective
Type :datetime.datetime or None
expires
Type :datetime.datetime or None
lang

Content language code. en is default value.

class ptah.cms.Content(**kw)

Content

class ptah.cms.BaseContainer(**kw)

Content container implementation.

class ptah.cms.Container(**kw)

container for content, it just for inheritance

keys()

Return an list of the keys in the container.

get(key, default=None)

Get a value for a key

The default is returned if there is no value for the key.

items()

Return the items of the container.

values()

Return an list of the values in the container.

__contains__(key)

Tell if a key exists in the mapping.

__getitem__(key)

Get a value for a key

A KeyError is raised if there is no value for the key.

__setitem__(key, item)

Set a new item in the container.

__delitem__(item, flush=True)

Delete a value from the container using the key.

Content loading

ptah.cms.load(uri, permission=None)

Load node by uri and initialize __parent__ attributes. Also checks permission if permissin is specified.

Parameters:
  • uri – Node uri
  • permission (Permission id or None) – Check permission on node object
Raises:
  • KeyError – Node with this uri is not found.
  • Forbidden – If current principal doesn’t pass permission check on loaded node.
ptah.cms.load_parents(node)

Load and initialize __parent__ attribute for node. Returns list of loaded parents.

Parameters:node – ptah.cms.Node node

Type system

ptah.cms.Type(name, title=None, fieldset=None, **kw)

Declare new type. This function has to be called within a content class declaration.

class MyContent(ptah.cms.Content):

    __type__ = Type('My content')

Application Root/Factory/Policy

ptah.cms.get_app_factories()

Get all registered application factories

class ptah.cms.ApplicationRoot(**kw)

Persistent application root

class ptah.cms.ApplicationPolicy(request)

Application policy

class ptah.cms.ApplicationFactory(cls, path='', name='', title='', policy=<class 'ptah.cms.root.ApplicationPolicy'>, default_root=None, parent_factory=None, config=None)

Application factory

ptah.cms.get_policy()

Get current policy

ptah.cms.set_policy(policy)

Set current policy

Blob api

ptah.cms.blobStorage
class ptah.cms.IBlob
class ptah.cms.IBlobStorage

Content schema

class ptah.cms.ContentSchema
class ptah.cms.ContentNameSchema

Permissions

ptah.cms.View
ptah.cms.AddContent
ptah.cms.DeleteContent
ptah.cms.ModifyContent
ptah.cms.ShareContent
ptah.cms.NOT_ALLOWED
ptah.cms.ALL_PERMISSIONS

Project Versions

Table Of Contents

Previous topic

ptah

Next topic

ptah.form

This Page