Back to index

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

List of all members.

Public Member Functions

def __init__
def edit
def Title
def Description
def testCondition
def getAction
def getActionExpression
def setActionExpression
def getCondition
def getPermissions
def getCategory
def getVisibility
def getMapping
def clone
def getInfoData

Public Attributes

 id
 title
 description
 category
 condition
 permissions
 priority
 visible
 action

Static Public Attributes

tuple security = ClassSecurityInfo()

Private Member Functions

def _getActionObject

Static Private Attributes

int __allow_access_to_unprotected_subobjects__ = 1

Detailed Description

Represent a single selectable action.

Actions generate links to views of content, or to specific methods
of the site.  They can be filtered via their conditions.

Definition at line 243 of file ActionInformation.py.


Constructor & Destructor Documentation

def CMFCore.ActionInformation.ActionInformation.__init__ (   self,
  id,
  title = '',
  description = '',
  category = 'object',
  condition = '',
  permissions = (),
  priority = 10,
  visible = True,
  action = '' 
)
Set up an instance.

Definition at line 267 of file ActionInformation.py.

00267 
00268                 ):
00269         """ Set up an instance.
00270         """
00271         self.edit( id
00272                  , title
00273                  , description
00274                  , category
00275                  , condition
00276                  , permissions
00277                  , priority
00278                  , visible
00279                  , action
00280                  )

Here is the call graph for this function:


Member Function Documentation

Find the action object, working around name changes.

Definition at line 354 of file ActionInformation.py.

00354 
00355     def _getActionObject( self ):
00356 
00357         """ Find the action object, working around name changes.
00358         """
00359         action = getattr( self, 'action', None )
00360 
00361         if action is None:  # Forward compatibility, used to be '_action'
00362             action = getattr( self, '_action', None )
00363             if action is not None:
00364                 self.action = self._action
00365                 del self._action
00366 
00367         return action

Here is the caller graph for this function:

Get a newly-created AI just like us.

Definition at line 436 of file ActionInformation.py.

00436 
00437     def clone( self ):
00438         """ Get a newly-created AI just like us.
00439         """
00440         return self.__class__( priority=self.priority, **self.getMapping() )

Here is the call graph for this function:

Return a description of the action.

Definition at line 329 of file ActionInformation.py.

00329 
00330     def Description( self ):
00331 
00332         """ Return a description of the action.
00333         """
00334         return self.description

Here is the caller graph for this function:

def CMFCore.ActionInformation.ActionInformation.edit (   self,
  id = _unchanged,
  title = _unchanged,
  description = _unchanged,
  category = _unchanged,
  condition = _unchanged,
  permissions = _unchanged,
  priority = _unchanged,
  visible = _unchanged,
  action = _unchanged 
)
Edit the specified properties.

Definition at line 292 of file ActionInformation.py.

00292 
00293             ):
00294         """Edit the specified properties.
00295         """
00296 
00297         if id is not _unchanged:
00298             self.id = id
00299         if title is not _unchanged:
00300             self.title = title
00301         if description is not _unchanged:
00302             self.description = description
00303         if category is not _unchanged:
00304             self.category = category
00305         if condition is not _unchanged:
00306             if condition and isinstance(condition, basestring):
00307                 condition = Expression(condition)
00308             self.condition = condition
00309         if permissions is not _unchanged:
00310             if permissions == ('',):
00311                 permissions = ()
00312             self.permissions = permissions
00313         if priority is not _unchanged:
00314             self.priority = priority
00315         if visible is not _unchanged:
00316             self.visible = visible
00317         if action is not _unchanged:
00318             if action and isinstance(action, basestring):
00319                 action = Expression(action)
00320             self.setActionExpression(action)

Here is the caller graph for this function:

Compute the action using context, 'ec'; return a mapping of
    info about the action.

Definition at line 346 of file ActionInformation.py.

00346 
00347     def getAction( self, ec ):
00348 
00349         """ Compute the action using context, 'ec'; return a mapping of
00350             info about the action.
00351         """
00352         return ActionInfo(self, ec)

Return the text of the TALES expression for our URL.

Definition at line 369 of file ActionInformation.py.

00369 
00370     def getActionExpression( self ):
00371 
00372         """ Return the text of the TALES expression for our URL.
00373         """
00374         action = self._getActionObject()
00375         expr = action and action.text or ''
00376         if expr and isinstance(expr, basestring):
00377             if ( not expr.startswith('string:')
00378                  and not expr.startswith('python:') ):
00379                 expr = 'string:${object_url}/%s' % expr
00380                 self.action = Expression( expr )
00381         return expr

Here is the call graph for this function:

Here is the caller graph for this function:

Return the category in which the action should be grouped.

Definition at line 408 of file ActionInformation.py.

00408 
00409     def getCategory( self ):
00410 
00411         """ Return the category in which the action should be grouped.
00412         """
00413         return self.category or 'object'

Return the text of the TALES expression for our condition.

Definition at line 392 of file ActionInformation.py.

00392 
00393     def getCondition(self):
00394 
00395         """ Return the text of the TALES expression for our condition.
00396         """
00397         return getattr( self, 'condition', None ) and self.condition.text or ''

Get the data needed to create an ActionInfo.

Definition at line 442 of file ActionInformation.py.

00442 
00443     def getInfoData(self):
00444         """ Get the data needed to create an ActionInfo.
00445         """
00446         lazy_keys = []
00447         lazy_map = self.getMapping()
00448 
00449         if lazy_map['action']:
00450             lazy_map['url'] = self._getActionObject()
00451             lazy_keys.append('url')
00452         else:
00453             lazy_map['url'] = ''
00454         del lazy_map['action']
00455 
00456         if lazy_map['condition']:
00457             lazy_map['available'] = self.testCondition
00458             lazy_keys.append('available')
00459         else:
00460             lazy_map['available'] = True
00461         del lazy_map['condition']
00462 
00463         return (lazy_map, lazy_keys)
00464 
00465 InitializeClass( ActionInformation )
00466 

Here is the call graph for this function:

Get a mapping of this object's data.

Definition at line 422 of file ActionInformation.py.

00422 
00423     def getMapping(self):
00424         """ Get a mapping of this object's data.
00425         """
00426         return { 'id': self.id,
00427                  'title': self.title or self.id,
00428                  'description': self.description,
00429                  'category': self.category or 'object',
00430                  'condition': getattr(self, 'condition', None)
00431                               and self.condition.text or '',
00432                  'permissions': self.permissions,
00433                  'visible': bool(self.visible),
00434                  'action': self.getActionExpression() }

Here is the call graph for this function:

Here is the caller graph for this function:

Return the permission, if any, required to execute the action.

Return an empty tuple if no permission is required.

Definition at line 399 of file ActionInformation.py.

00399 
00400     def getPermissions( self ):
00401 
00402         """ Return the permission, if any, required to execute the action.
00403 
00404         Return an empty tuple if no permission is required.
00405         """
00406         return self.permissions

Return whether the action should be visible in the CMF UI.

Definition at line 415 of file ActionInformation.py.

00415 
00416     def getVisibility( self ):
00417 
00418         """ Return whether the action should be visible in the CMF UI.
00419         """
00420         return bool(self.visible)

Definition at line 383 of file ActionInformation.py.

00383 
00384     def setActionExpression(self, action):
00385         if action and isinstance(action, basestring):
00386             if ( not action.startswith('string:')
00387                  and not action.startswith('python:') ):
00388                 action = 'string:${object_url}/%s' % action
00389             action = Expression( action )
00390         self.action = action

Evaluate condition using context, 'ec', and return 0 or 1.

Definition at line 336 of file ActionInformation.py.

00336 
00337     def testCondition( self, ec ):
00338 
00339         """ Evaluate condition using context, 'ec', and return 0 or 1.
00340         """
00341         if self.condition:
00342             return bool( self.condition(ec) )
00343         else:
00344             return True

Here is the caller graph for this function:

Return the Action title.

Definition at line 322 of file ActionInformation.py.

00322 
00323     def Title(self):
00324 
00325         """ Return the Action title.
00326         """
00327         return self.title or self.getId()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 253 of file ActionInformation.py.

Definition at line 363 of file ActionInformation.py.

Definition at line 303 of file ActionInformation.py.

Definition at line 307 of file ActionInformation.py.

Definition at line 301 of file ActionInformation.py.

Definition at line 297 of file ActionInformation.py.

Definition at line 311 of file ActionInformation.py.

Definition at line 313 of file ActionInformation.py.

tuple CMFCore.ActionInformation.ActionInformation.security = ClassSecurityInfo() [static]

Definition at line 255 of file ActionInformation.py.

Definition at line 299 of file ActionInformation.py.

Definition at line 315 of file ActionInformation.py.


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