2.1. Registration

2.1.1. Utilities

2.1.1.1. Set registration info

lfc.utils.registration.register_content_type(klass, name, sub_types=[], templates=[], default_template=None, global_addable=True, workflow=None)

Registers a content type.

Parameters:

klass
The klass which should be registered as content type. Must be a sub class of BaseContent.
name
The unique name under which the content type should be registered.
sub_types
Content types which are allowed to be added as children to the registered object. Must be a list of strings with valid names of content types.
templates
Templates which are allowed to be selected for the registered object. Must be a list of strings with valid template names.
default_template
Default template of the registered object.
global_addable
Decides whether the content type is global addable or just within specific content types.
Workflow
The workflow of the content type. Needs to be a string with the unique workflow name.
lfc.utils.registration.register_template(name, path, children_columns=0, images_columns=0)

Registers a template.

Parameters:

name
The name of the template.
path
The path to the template file.
children_columns
The amount of columns for sub pages. This can be used within templates to structure children.
images_columns
The amount of columns for images. This can be used within templates to structure images.
lfc.utils.registration.register_sub_type(klass, name)

Registers a content type as a allowed sub type to another content type.

Parameters:

klass
The class which should be registered.
name
The name of the content type to which the passed content type (klass) should be registered.

2.1.1.2. Get registration info

lfc.utils.registration.get_info(obj_or_type)

Returns the ContentTypeRegistration for the passed object or type. Returns None if the content type registry is not found.

Parameters:

obj_or_type
The object or type for which the information should be returned. Must be an instance of BaseContent or a String with a valid type name.
lfc.utils.registration.get_allowed_subtypes(obj_or_type=None)

Returns all allowed sub types for given object or type. Returns a list of ContentTypeRegistrations.

Parameters:

obj_or_type
Must be an instance of BaseContent, a string with a valid type name or None. If it’s None the conten type registrations of all global addable content types are returned.
lfc.utils.registration.get_default_template(obj_or_type)

Returns the default template for given object or type. Returns an instance of Template.

Parameters:

obj_or_type
The object or type for which the temlate should be returned. Must be an instance of BaseContent or a String with a valid type name.

2.1.2. Classes

class lfc.models.ContentTypeRegistration(*args, **kwargs)

Stores all registration relevant information of a registered content type.

Attributes:

type
The type of the registered content type.
name
The name of the registered content type. This is displayed to the LFC users to add a new content type. Also used by developers for registration purposes.
display_select_standard
If set to true the user can select a standard page for the object.
display_position
If set to true the user can set the position of the intances.
global_addable
if set to true instances of the content type can be added to the portal.
subtypes
Allowed sub types which can be added to instances of the content type.
templates
Allowed templates which can be selected for instances of the content type.
default_template
The default template which is assigned when a instance of the content type is created.
workflow
Stores the workflow of this content type. All instances “inherit” this workflow and will get the initial state of it when created.

Table Of Contents

Previous topic

2. API

Next topic

2.2. Content

This Page