Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
CMFCore.TypesTool.TypeInformation Class Reference
Inheritance diagram for CMFCore.TypesTool.TypeInformation:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.TypesTool.TypeInformation:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def manage_setMethodAliases
def Title
def Description
def Metatype
def getIcon
def allowType
def getId
def allowDiscussion
def globalAllow
def listActions
def constructInstance
def getMethodAliases
def setMethodAliases
def queryMethodID

Public Attributes

 id

Static Public Attributes

tuple manage_options
tuple security = ClassSecurityInfo()
string title = ''
string description = ''
string i18n_domain = ''
string content_meta_type = ''
string content_icon = ''
string immediate_view = ''
 filter_content_types = True
tuple allowed_content_types = ()
 allow_discussion = False
 global_allow = True
tuple manage_aliases = PageTemplateFile( 'typeinfoAliases.zpt', _wwwdir )

Private Member Functions

def _finishConstruction

Private Attributes

 _actions
 _aliases
 _p_changed

Static Private Attributes

tuple _basic_properties
tuple _advanced_properties

Detailed Description

Base class for information about a content type.

Definition at line 60 of file TypesTool.py.


Constructor & Destructor Documentation

def CMFCore.TypesTool.TypeInformation.__init__ (   self,
  id,
  kw 
)

Definition at line 120 of file TypesTool.py.

00120 
00121     def __init__(self, id, **kw):
00122 
00123         self.id = id
00124         self._actions = ()
00125         self._aliases = {}
00126 
00127         if not kw:
00128             return
00129 
00130         kw = kw.copy()  # Get a modifiable dict.
00131 
00132         if (not kw.has_key('content_meta_type')
00133             and kw.has_key('meta_type')):
00134             kw['content_meta_type'] = kw['meta_type']
00135 
00136         if (not kw.has_key('content_icon')
00137             and kw.has_key('icon')):
00138             kw['content_icon'] = kw['icon']
00139 
00140         self.manage_changeProperties(**kw)
00141 
00142         actions = kw.get( 'actions', () )
00143         for action in actions:
00144             self.addAction(
00145                   id=action['id']
00146                 , name=action['title']
00147                 , action=action['action']
00148                 , condition=action.get('condition')
00149                 , permission=action.get( 'permissions', () )
00150                 , category=action.get('category', 'object')
00151                 , visible=action.get('visible', True)
00152                 )
00153 
00154         self.setMethodAliases(kw.get('aliases', {}))


Member Function Documentation

def CMFCore.TypesTool.TypeInformation._finishConstruction (   self,
  ob 
) [private]
    Finish the construction of a content object.
    Set its portal_type, insert it into the workflows.

Definition at line 281 of file TypesTool.py.

00281 
00282     def _finishConstruction(self, ob):
00283         """
00284             Finish the construction of a content object.
00285             Set its portal_type, insert it into the workflows.
00286         """
00287         if hasattr(ob, '_setPortalTypeName'):
00288             ob._setPortalTypeName(self.getId())
00289 
00290         if hasattr(aq_base(ob), 'notifyWorkflowCreated'):
00291             ob.notifyWorkflowCreated()
00292 
00293         ob.reindexObject()
00294         return ob

Here is the call graph for this function:

Here is the caller graph for this function:

    Can this type of object support discussion?

Definition at line 247 of file TypesTool.py.

00247 
00248     def allowDiscussion( self ):
00249         """
00250             Can this type of object support discussion?
00251         """
00252         return self.allow_discussion

def CMFCore.TypesTool.TypeInformation.allowType (   self,
  contentType 
)
    Can objects of 'contentType' be added to containers whose
    type object we are?

Definition at line 223 of file TypesTool.py.

00223 
00224     def allowType( self, contentType ):
00225         """
00226             Can objects of 'contentType' be added to containers whose
00227             type object we are?
00228         """
00229         if not self.filter_content_types:
00230             ti = self.getTypeInfo( contentType )
00231             if ti is None or ti.globalAllow():
00232                 return 1
00233 
00234         #If a type is enabled to filter and no content_types are allowed
00235         if not self.allowed_content_types:
00236             return 0
00237 
00238         if contentType in self.allowed_content_types:
00239             return 1
00240 
00241         return 0

Here is the call graph for this function:

def CMFCore.TypesTool.TypeInformation.constructInstance (   self,
  container,
  id,
  args,
  kw 
)
Build an instance of the type.

Builds the instance in 'container', using 'id' as its id.
Returns the object.

Definition at line 267 of file TypesTool.py.

00267 
00268     def constructInstance(self, container, id, *args, **kw):
00269         """Build an instance of the type.
00270 
00271         Builds the instance in 'container', using 'id' as its id.
00272         Returns the object.
00273         """
00274         if not self.isConstructionAllowed(container):
00275             raise AccessControl_Unauthorized('Cannot create %s' % self.getId())
00276 
00277         ob = self._constructInstance(container, id, *args, **kw)
00278 
00279         return self._finishConstruction(ob)

Here is the call graph for this function:

    Textual description of the class of objects (intended
    for display in a "constructor list").

Definition at line 196 of file TypesTool.py.

00196 
00197     def Description(self):
00198         """
00199             Textual description of the class of objects (intended
00200             for display in a "constructor list").
00201         """
00202         if self.description and self.i18n_domain:
00203             return Message(self.description, self.i18n_domain)
00204         else:
00205             return self.description

Here is the caller graph for this function:

    Returns the icon for this content object.

Definition at line 216 of file TypesTool.py.

00216 
00217     def getIcon(self):
00218         """
00219             Returns the icon for this content object.
00220         """
00221         return self.content_icon

Here is the caller graph for this function:

Definition at line 243 of file TypesTool.py.

00243 
00244     def getId(self):
00245         return self.id

Get method aliases dict.

Definition at line 296 of file TypesTool.py.

00296 
00297     def getMethodAliases(self):
00298         """ Get method aliases dict.
00299         """
00300         aliases = self._aliases
00301         # for aliases created with CMF 1.5.0beta
00302         for key, method_id in aliases.items():
00303             if isinstance(method_id, tuple):
00304                 aliases[key] = method_id[0]
00305                 self._p_changed = True
00306         return aliases.copy()

Should this type be implicitly addable anywhere?

Definition at line 254 of file TypesTool.py.

00254 
00255     def globalAllow(self):
00256         """
00257         Should this type be implicitly addable anywhere?
00258         """
00259         return self.global_allow

def CMFCore.TypesTool.TypeInformation.listActions (   self,
  info = None,
  object = None 
)
Return a sequence of the action info objects for this type.

Definition at line 261 of file TypesTool.py.

00261 
00262     def listActions(self, info=None, object=None):
00263         """ Return a sequence of the action info objects for this type.
00264         """
00265         return self._actions or ()

Here is the caller graph for this function:

Config method aliases.

Definition at line 162 of file TypesTool.py.

00162 
00163     def manage_setMethodAliases(self, REQUEST):
00164         """ Config method aliases.
00165         """
00166         form = REQUEST.form
00167         aliases = {}
00168         for k, v in form['aliases'].items():
00169             v = v.strip()
00170             if v:
00171                 aliases[k] = v
00172 
00173         _dict = {}
00174         for k, v in form['methods'].items():
00175             if aliases.has_key(k):
00176                 _dict[ aliases[k] ] = v
00177         self.setMethodAliases(_dict)
00178         REQUEST.RESPONSE.redirect('%s/manage_aliases' % self.absolute_url())

Here is the call graph for this function:

    Returns the Zope 'meta_type' for this content object.
    May be used for building the list of portal content
    meta types.

Definition at line 207 of file TypesTool.py.

00207 
00208     def Metatype(self):
00209         """
00210             Returns the Zope 'meta_type' for this content object.
00211             May be used for building the list of portal content
00212             meta types.
00213         """
00214         return self.content_meta_type

def CMFCore.TypesTool.TypeInformation.queryMethodID (   self,
  alias,
  default = None,
  context = None 
)
Query method ID by alias.

Definition at line 323 of file TypesTool.py.

00323 
00324     def queryMethodID(self, alias, default=None, context=None):
00325         """ Query method ID by alias.
00326         """
00327         aliases = self._aliases
00328         method_id = aliases.get(alias, default)
00329         # for aliases created with CMF 1.5.0beta
00330         if isinstance(method_id, tuple):
00331             method_id = method_id[0]
00332         return method_id
00333 
00334 InitializeClass(TypeInformation)
00335 

Set method aliases dict.

Definition at line 308 of file TypesTool.py.

00308 
00309     def setMethodAliases(self, aliases):
00310         """ Set method aliases dict.
00311         """
00312         _dict = {}
00313         for k, v in aliases.items():
00314             v = v.strip()
00315             if v:
00316                 _dict[ k.strip() ] = v
00317         if not getattr(self, '_aliases', None) == _dict:
00318             self._aliases = _dict
00319             return True
00320         else:
00321             return False

Here is the caller graph for this function:

    Return the "human readable" type name (note that it
    may not map exactly to the 'portal_type', e.g., for
    l10n/i18n or where a single content class is being
    used twice, under different names.

Definition at line 183 of file TypesTool.py.

00183 
00184     def Title(self):
00185         """
00186             Return the "human readable" type name (note that it
00187             may not map exactly to the 'portal_type', e.g., for
00188             l10n/i18n or where a single content class is being
00189             used twice, under different names.
00190         """
00191         if self.title and self.i18n_domain:
00192             return Message(self.title, self.i18n_domain)
00193         else:
00194             return self.title or self.getId()

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 123 of file TypesTool.py.

Initial value:
(
        {'id':'immediate_view', 'type': 'string', 'mode':'w',
         'label':'Initial view name'},
        {'id':'global_allow', 'type': 'boolean', 'mode':'w',
         'label':'Implicitly addable?'},
        {'id':'filter_content_types', 'type': 'boolean', 'mode':'w',
         'label':'Filter content types?'},
        {'id':'allowed_content_types'
         , 'type': 'multiple selection'
         , 'mode':'w'
         , 'label':'Allowed content types'
         , 'select_variable':'listContentTypes'
         },
        { 'id': 'allow_discussion', 'type': 'boolean', 'mode': 'w'
          , 'label': 'Allow Discussion?'
          },
        )

Definition at line 91 of file TypesTool.py.

Definition at line 124 of file TypesTool.py.

Initial value:
(
        {'id':'title', 'type': 'string', 'mode':'w',
         'label':'Title'},
        {'id':'description', 'type': 'text', 'mode':'w',
         'label':'Description'},
        {'id':'i18n_domain', 'type': 'string', 'mode':'w',
         'label':'I18n Domain'},
        {'id':'content_icon', 'type': 'string', 'mode':'w',
         'label':'Icon'},
        {'id':'content_meta_type', 'type': 'string', 'mode':'w',
         'label':'Product meta type'},
        )

Definition at line 78 of file TypesTool.py.

Definition at line 304 of file TypesTool.py.

Definition at line 117 of file TypesTool.py.

Definition at line 116 of file TypesTool.py.

Definition at line 113 of file TypesTool.py.

Definition at line 112 of file TypesTool.py.

Definition at line 110 of file TypesTool.py.

Definition at line 115 of file TypesTool.py.

Definition at line 118 of file TypesTool.py.

Definition at line 111 of file TypesTool.py.

Definition at line 122 of file TypesTool.py.

Definition at line 114 of file TypesTool.py.

tuple CMFCore.TypesTool.TypeInformation.manage_aliases = PageTemplateFile( 'typeinfoAliases.zpt', _wwwdir ) [static]

Definition at line 159 of file TypesTool.py.

Initial value:
( SimpleItemWithProperties.manage_options[:1]
                     + ( {'label':'Aliases',
                          'action':'manage_aliases'}, )
                     + ActionProviderBase.manage_options
                     + SimpleItemWithProperties.manage_options[1:]
                     )

Definition at line 65 of file TypesTool.py.

tuple CMFCore.TypesTool.TypeInformation.security = ClassSecurityInfo() [static]

Definition at line 109 of file TypesTool.py.


The documentation for this class was generated from the following file: