Logo Search packages:      
Sourcecode: zope-cmf1.4 version File versions

portal_types.py

##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
""" Type registration tool interface.

$Id: portal_types.py,v 1.13.14.2 2004/04/23 21:11:34 sidnei Exp $
"""

from Interface import Attribute
try:
    from Interface import Interface
except ImportError:
    # for Zope versions before 2.6.0
    from Interface import Base as Interface


00026 class ContentTypeInformation(Interface):
    """
        Registry entry interface.
    """
00030     def Metatype():
        """
            Return the Zope 'meta_type' for this content object.
        """
    
00035     def Title():
        """
            Return the "human readable" type name (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.
        """
    
00043     def Description():
        """
            Textual description of the class of objects (intended
            for display in a "constructor list").
        """
    
00049     def isConstructionAllowed(container):
        """
        Does the current user have the permission required in
        order to construct an instance?
        """

00055     def allowType(contentType):
        """
            Can objects of 'contentType' be added to containers whose
            type object we are?
        """

00061     def constructInstance(container, id):
        """
            Build a "bare" instance of the appropriate type in
            'container', using 'id' as its id.  Return the instance,
            seated in the container.
        """

00068     def allowDiscussion():
        """
            Can this type of object support discussion?
        """

00073     def getActionById(id):
        """
            Return the URL of the action whose ID is id.
        """

00078     def getIcon():
        """
            Returns the portal-relative icon for this type.
        """

00083 class portal_types(Interface):
    """
        Provides a configurable registry of portal content types.
    """
    id = Attribute('id', 'Must be set to "portal_types"')

    # getType__roles__ = None  # Public
00090     def getTypeInfo(contentType):
        """
            Return an instance which implements the
            ContentTypeInformation interface, corresponding to
            the specified 'contentType'.  If contentType is actually
            an object, rather than a string, attempt to look up
            the appropriate type info using its portal_type.
        """

    # listTypeInfo__roles__ = None  # Public
00100     def listTypeInfo(container=None):
        """
            Return a sequence of instances which implement the
            ContentTypeInformation interface, one for each content
            type regisetered in the portal.  If the container
            is specified, the list will be filtered according to
            the user's permissions.
        """

00109     def listContentTypes(container=None, by_metatype=0):
        """
            Return list of content types, or the equivalent
            metatypes;  if 'container' is passed, then filter
            the list to include only types which are addable in
            'container'.
        """
    
00117     def constructContent(contentType, container, id, RESPONSE=None
                        , *args, **kw):
        """
            Build an instance of the appropriate content class in
            'container', using 'id'.  If RESPONSE is provided, redirect
            to the new object's "initial view".
        """

Generated by  Doxygen 1.6.0   Back to index