Back to index

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

List of all members.

Public Member Functions

def __init__
def addElementPolicy
def removeElementPolicy
def updateElementPolicy
def listElementSpecs
def getElementSpec
def addElementSpec
def removeElementSpec
def listPolicies

Public Attributes

 element_specs

Static Public Attributes

tuple security = ClassSecurityInfo()
string meta_type = 'Metadata Schema'
string publisher = ''
tuple manage_options
tuple elementPoliciesForm = DTMLFile( 'metadataElementPolicies', _dtmldir )

Detailed Description

Describe a metadata schema.

Definition at line 190 of file MetadataTool.py.


Constructor & Destructor Documentation

def CMFDefault.MetadataTool.MetadataSchema.__init__ (   self,
  id,
  element_specs = () 
)

Definition at line 200 of file MetadataTool.py.

00200 
00201     def __init__( self, id, element_specs=() ):
00202         self._setId( id )
00203         self.element_specs = PersistentMapping()
00204         for name, is_multi_valued in element_specs:
00205             self.element_specs[ name ] = ElementSpec( is_multi_valued )
00206 

Here is the call graph for this function:


Member Function Documentation

def CMFDefault.MetadataTool.MetadataSchema.addElementPolicy (   self,
  element,
  content_type,
  is_required,
  supply_default,
  default_value,
  enforce_vocabulary,
  allowed_vocabulary,
  REQUEST = None 
)
Add a type-specific policy for one of our elements.

Definition at line 231 of file MetadataTool.py.

00231 
00232                         ):
00233         """ Add a type-specific policy for one of our elements.
00234         """
00235         if content_type == '<default>':
00236             content_type = None
00237 
00238         spec = self.getElementSpec( element )
00239         spec.addPolicy( content_type )
00240         policy = spec.getPolicy( content_type )
00241         policy.edit( is_required
00242                    , supply_default
00243                    , default_value
00244                    , enforce_vocabulary
00245                    , allowed_vocabulary
00246                    )
00247         if REQUEST is not None:
00248             REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
00249                + '/elementPoliciesForm'
00250                + '?element=' + element
00251                + '&manage_tabs_message=Policy+added.'
00252                )

Here is the call graph for this function:

def CMFDefault.MetadataTool.MetadataSchema.addElementSpec (   self,
  element,
  is_multi_valued,
  REQUEST = None 
)
Add 'element' to our list of managed elements.

Definition at line 325 of file MetadataTool.py.

00325 
00326     def addElementSpec( self, element, is_multi_valued, REQUEST=None ):
00327         """ Add 'element' to our list of managed elements.
00328         """
00329         # Don't replace.
00330         if self.element_specs.has_key( element ):
00331            return
00332 
00333         self.element_specs[ element ] = ElementSpec( is_multi_valued )
00334 
00335         if REQUEST is not None:
00336             REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
00337                + '/propertiesForm'
00338                + '?manage_tabs_message=Element+' + element + '+added.'
00339                )

Here is the call graph for this function:

Return an ElementSpec for the given 'element'.

Definition at line 319 of file MetadataTool.py.

00319 
00320     def getElementSpec( self, element ):
00321         """ Return an ElementSpec for the given 'element'.
00322         """
00323         return self.element_specs[ element ].__of__( self )

Here is the caller graph for this function:

Return a list of ElementSpecs representing the elements we manage.

Definition at line 310 of file MetadataTool.py.

00310 
00311     def listElementSpecs( self ):
00312         """ Return a list of ElementSpecs representing the elements we manage.
00313         """
00314         res = []
00315         for k, v in self.element_specs.items():
00316             res.append((k, v.__of__(self)))
00317         return res

Here is the caller graph for this function:

def CMFDefault.MetadataTool.MetadataSchema.listPolicies (   self,
  typ = None 
)
Show all policies for a given content type

o If 'typ' is none, return the list of default policies.

Definition at line 353 of file MetadataTool.py.

00353 
00354     def listPolicies( self, typ=None ):
00355         """ Show all policies for a given content type
00356 
00357         o If 'typ' is none, return the list of default policies.
00358         """
00359         result = []
00360         for element, spec in self.listElementSpecs():
00361             result.append( ( element, spec.getPolicy( typ ) ) )
00362         return result
00363 
00364 InitializeClass(MetadataSchema)
00365 

Here is the call graph for this function:

def CMFDefault.MetadataTool.MetadataSchema.removeElementPolicy (   self,
  element,
  content_type,
  REQUEST = None 
)
Remvoe a type-specific policy for one of our elements.

Definition at line 258 of file MetadataTool.py.

00258 
00259                            ):
00260         """ Remvoe a type-specific policy for one of our elements.
00261         """
00262         if content_type == '<default>':
00263             content_type = None
00264 
00265         spec = self.getElementSpec( element )
00266         spec.removePolicy( content_type )
00267         if REQUEST is not None:
00268             REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
00269                + '/elementPoliciesForm'
00270                + '?element=' + element
00271                + '&manage_tabs_message=Policy+removed.'
00272                )

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFDefault.MetadataTool.MetadataSchema.removeElementSpec (   self,
  element,
  REQUEST = None 
)
Remove 'element' from our list of managed elements.

Definition at line 341 of file MetadataTool.py.

00341 
00342     def removeElementSpec( self, element, REQUEST=None ):
00343         """ Remove 'element' from our list of managed elements.
00344         """
00345         del self.element_specs[ element ]
00346 
00347         if REQUEST is not None:
00348             REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
00349                + '/propertiesForm'
00350                + '?manage_tabs_message=Element+' + element + '+removed.'
00351                )

Here is the call graph for this function:

def CMFDefault.MetadataTool.MetadataSchema.updateElementPolicy (   self,
  element,
  content_type,
  is_required,
  supply_default,
  default_value,
  enforce_vocabulary,
  allowed_vocabulary,
  REQUEST = None 
)
Update a policy for one of our elements 

o 'content_type' will be '<default>' when we edit the default.

Definition at line 283 of file MetadataTool.py.

00283 
00284                            ):
00285         """ Update a policy for one of our elements 
00286 
00287         o 'content_type' will be '<default>' when we edit the default.
00288         """
00289         if content_type == '<default>':
00290             content_type = None
00291         spec = self.getElementSpec( element )
00292         policy = spec.getPolicy( content_type )
00293         policy.edit( is_required
00294                    , supply_default
00295                    , default_value
00296                    , enforce_vocabulary
00297                    , allowed_vocabulary
00298                    )
00299         if REQUEST is not None:
00300             REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
00301                + '/elementPoliciesForm'
00302                + '?element=' + element
00303                + '&manage_tabs_message=Policy+updated.'
00304                )
00305 

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 202 of file MetadataTool.py.

tuple CMFDefault.MetadataTool.MetadataSchema.elementPoliciesForm = DTMLFile( 'metadataElementPolicies', _dtmldir ) [static]

Definition at line 219 of file MetadataTool.py.

Initial value:
( ( { 'label'      : 'Elements'
                         , 'action'     : 'elementPoliciesForm'
                         }
                       ,
                       )
                     + SimpleItem.manage_options
                     )

Definition at line 210 of file MetadataTool.py.

string CMFDefault.MetadataTool.MetadataSchema.meta_type = 'Metadata Schema' [static]

Definition at line 197 of file MetadataTool.py.

Definition at line 198 of file MetadataTool.py.

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

Definition at line 195 of file MetadataTool.py.


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