Back to index

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

List of all members.

Public Member Functions

def isConstructionAllowed
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 security = ClassSecurityInfo()
string permission = ''
string constructor_path = ''
tuple manage_options
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 _constructInstance

Static Private Attributes

 __implements__ = z2ITypeInformation
tuple _properties

Detailed Description

Invokes a script rather than a factory to create the content.

Definition at line 466 of file TypesTool.py.


Member Function Documentation

def CMFCore.TypesTool.ScriptableTypeInformation._constructInstance (   self,
  container,
  id,
  args,
  kw 
) [private]
Build a bare instance of the appropriate type.

Does not do any security checks.

Returns the object without calling _finishConstruction().

Definition at line 501 of file TypesTool.py.

00501 
00502     def _constructInstance(self, container, id, *args, **kw):
00503         """Build a bare instance of the appropriate type.
00504 
00505         Does not do any security checks.
00506 
00507         Returns the object without calling _finishConstruction().
00508         """
00509         constructor = self.restrictedTraverse( self.constructor_path )
00510 
00511         # make sure ownership is explicit before switching the context
00512         if not hasattr( aq_base(constructor), '_owner' ):
00513             constructor._owner = aq_get(constructor, '_owner')
00514         #   Rewrap to get into container's context.
00515         constructor = aq_base(constructor).__of__( container )
00516 
00517         id = str(id)
00518         return constructor(container, id, *args, **kw)
00519 
00520 InitializeClass(ScriptableTypeInformation)
00521 

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 
) [inherited]
    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 
) [inherited]
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:

def CMFCore.TypesTool.TypeInformation.getIcon (   self) [inherited]
    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:

def CMFCore.TypesTool.TypeInformation.getId (   self) [inherited]

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

Does the current user have the permission required in
order to construct an instance?

Definition at line 490 of file TypesTool.py.

00490 
00491     def isConstructionAllowed(self, container):
00492         """
00493         Does the current user have the permission required in
00494         order to construct an instance?
00495         """
00496         permission = self.permission
00497         if permission and not _checkPermission( permission, container ):
00498             return 0
00499         return 1

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.TypesTool.TypeInformation.listActions (   self,
  info = None,
  object = None 
) [inherited]
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:

def CMFCore.TypesTool.TypeInformation.manage_setMethodAliases (   self,
  REQUEST 
) [inherited]
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:

def CMFCore.TypesTool.TypeInformation.Metatype (   self) [inherited]
    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 
) [inherited]
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 

def CMFCore.TypesTool.TypeInformation.setMethodAliases (   self,
  aliases 
) [inherited]
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:

def CMFCore.TypesTool.TypeInformation.Title (   self) [inherited]
    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

CMFCore.TypesTool.ScriptableTypeInformation.__implements__ = z2ITypeInformation [static, private]

Definition at line 472 of file TypesTool.py.

Initial value:
(TypeInformation._basic_properties + (
        {'id':'permission', 'type': 'string', 'mode':'w',
         'label':'Constructor permission'},
        {'id':'constructor_path', 'type': 'string', 'mode':'w',
         'label':'Constructor path'},
        ) + TypeInformation._advanced_properties)

Definition at line 476 of file TypesTool.py.

Definition at line 117 of file TypesTool.py.

Definition at line 116 of file TypesTool.py.

Definition at line 484 of file TypesTool.py.

string CMFCore.TypesTool.TypeInformation.content_icon = '' [static, inherited]

Definition at line 113 of file TypesTool.py.

string CMFCore.TypesTool.TypeInformation.content_meta_type = '' [static, inherited]

Definition at line 112 of file TypesTool.py.

string CMFCore.TypesTool.TypeInformation.description = '' [static, inherited]

Definition at line 110 of file TypesTool.py.

Definition at line 115 of file TypesTool.py.

Definition at line 118 of file TypesTool.py.

string CMFCore.TypesTool.TypeInformation.i18n_domain = '' [static, inherited]

Definition at line 111 of file TypesTool.py.

Definition at line 122 of file TypesTool.py.

string CMFCore.TypesTool.TypeInformation.immediate_view = '' [static, inherited]

Definition at line 114 of file TypesTool.py.

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

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.

Definition at line 483 of file TypesTool.py.

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

Reimplemented from CMFCore.TypesTool.TypeInformation.

Definition at line 474 of file TypesTool.py.

string CMFCore.TypesTool.TypeInformation.title = '' [static, inherited]

Definition at line 109 of file TypesTool.py.


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