Back to index

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

List of all members.

Public Member Functions

def __init__
def isMultiValued
def getPolicy
def listPolicies
def addPolicy
def removePolicy

Public Attributes

 is_multi_valued
 policies

Static Public Attributes

tuple security = ClassSecurityInfo()
int is_multi_valued = 0

Private Member Functions

def _makePolicy

Detailed Description

Represent all the tool knows about a single metadata element.

Definition at line 117 of file MetadataTool.py.


Constructor & Destructor Documentation

def CMFDefault.MetadataTool.ElementSpec.__init__ (   self,
  is_multi_valued 
)

Definition at line 129 of file MetadataTool.py.

00129 
00130     def __init__( self, is_multi_valued ):
00131         self.is_multi_valued  = is_multi_valued
00132         self.policies         = PersistentMapping()
00133         self.policies[ None ] = self._makePolicy()  # set default policy


Member Function Documentation

Definition at line 135 of file MetadataTool.py.

00135 
00136     def _makePolicy( self ):
00137         return MetadataElementPolicy( self.is_multi_valued )

Here is the caller graph for this function:

Add a policy to this element for objects of the given type.

Definition at line 166 of file MetadataTool.py.

00166 
00167     def addPolicy( self, typ ):
00168         """ Add a policy to this element for objects of the given type.
00169         """
00170         if typ is None:
00171             raise MetadataError, "Can't replace default policy."
00172 
00173         if self.policies.has_key( typ ):
00174             raise MetadataError, "Existing policy for content type:" + typ
00175 
00176         self.policies[ typ ] = self._makePolicy()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFDefault.MetadataTool.ElementSpec.getPolicy (   self,
  typ = None 
)
Find the policy for this element for objects of the given type.

o Return a default, if none found.

Definition at line 146 of file MetadataTool.py.

00146 
00147     def getPolicy( self, typ=None ):
00148         """ Find the policy for this element for objects of the given type.
00149 
00150         o Return a default, if none found.
00151         """
00152         try:
00153             return self.policies[ typ ].__of__(self)
00154         except KeyError:
00155             return self.policies[ None ].__of__(self)

    Is this element multi-valued?

Definition at line 139 of file MetadataTool.py.

00139 
00140     def isMultiValued( self ):
00141         """
00142             Is this element multi-valued?
00143         """
00144         return self.is_multi_valued

Return a list of all policies for this element.

Definition at line 157 of file MetadataTool.py.

00157 
00158     def listPolicies( self ):
00159         """ Return a list of all policies for this element.
00160         """
00161         res = []
00162         for k, v in self.policies.items():
00163             res.append((k, v.__of__(self)))
00164         return res

Remove the policy from this element for objects of the given type.

o Do *not* remvoe the default, however.

Definition at line 178 of file MetadataTool.py.

00178 
00179     def removePolicy( self, typ ):
00180         """ Remove the policy from this element for objects of the given type.
00181 
00182         o Do *not* remvoe the default, however.
00183         """
00184         if typ is None:
00185             raise MetadataError, "Can't remove default policy."
00186         del self.policies[ typ ]
00187 
00188 InitializeClass( ElementSpec )
00189 

Here is the caller graph for this function:


Member Data Documentation

Definition at line 127 of file MetadataTool.py.

Definition at line 130 of file MetadataTool.py.

Definition at line 131 of file MetadataTool.py.

tuple CMFDefault.MetadataTool.ElementSpec.security = ClassSecurityInfo() [static]

Definition at line 122 of file MetadataTool.py.


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