Back to index

plone3  3.1.7
constrains.py
Go to the documentation of this file.
00001 from zope.interface import Interface
00002 
00003 class IConstrainTypes(Interface):
00004     """
00005     Interface for folderish content types supporting restricting addable types 
00006     on a per-instance basis.
00007     """
00008         
00009     def getConstrainTypesMode():
00010         """
00011         Find out if add-restrictions are enabled. Returns 0 if they are 
00012         disabled (the type's default FTI-set allowable types is in effect), 
00013         1 if they are enabled (only a selected subset if allowed types will be
00014         available), and -1 if the allowed types should be acquired from the
00015         parent. Note that in this case, if the parent portal type is not the 
00016         same as the portal type of this object, fall back on the default (same
00017         as 0)
00018         """
00019         
00020     def getLocallyAllowedTypes():
00021         """
00022         Get the list of FTI ids for the types which should be allowed to be
00023         added in this container.
00024         """
00025         
00026     def getImmediatelyAddableTypes():
00027         """
00028         Return a subset of the FTI ids from getLocallyAllowedTypes() which 
00029         should be made most easily available.
00030         """
00031         
00032     def getDefaultAddableTypes():
00033         """
00034         Return a list of FTIs which correspond to the list of FTIs available
00035         when the constraint mode = 0 (that is, the types addable without any
00036         setLocallyAllowedTypes trickery involved)
00037         """
00038         
00039     def allowedContentTypes():
00040         """
00041         Return the list of currently permitted FTIs.
00042         """
00043             
00044 class ISelectableConstrainTypes(IConstrainTypes):
00045     """
00046     Extension to the IConstrainTypes interface for content types which allow
00047     the user to set the allowable content types and immediately available
00048     types.
00049     """
00050     
00051     def setConstrainTypesMode(mode):
00052         """
00053         Set how addable types is controlled in this class. If mode is 0, use
00054         the type's default FTI-set allowable types). If mode is 1, use only
00055         those types explicitly enabled using setLocallyAllowedTypes(). If
00056         mode is -1, acquire the allowable types from the parent. If the parent
00057         portal type is not the same as this object's type, fall back on the
00058         behaviour obtained if mode == 0.
00059         """
00060         
00061     def setLocallyAllowedTypes(types):
00062         """
00063         Set a list of type ids which should be allowed. This must be a 
00064         subset of the type's FTI-set allowable types. This list only comes
00065         into effect when the restrictions mode is 1 (enabled).
00066         """
00067         
00068     def setImmediatelyAddableTypes(types):
00069         """
00070         Set the list of type ids which should be immediately/most easily 
00071         addable. This list must be a subset of any types set in 
00072         setLocallyAllowedTypes.
00073         """
00074 
00075     def canSetConstrainTypes():
00076         """
00077         Return True if the current user is permitted to constrain addable
00078         types in this folderish object.
00079         """