Back to index

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

List of all members.

Public Member Functions

def __init__
def initializeLayers
def cleanupLayers
def __add__
def copy

Static Public Attributes

tuple security = ClassSecurityInfo()

Static Private Attributes

dictionary _properties

Detailed Description

Some layer management for schemas

Definition at line 296 of file __init__.py.


Constructor & Destructor Documentation

Definition at line 306 of file __init__.py.

00306 
00307     def __init__(self):
00308         DefaultLayerContainer.__init__(self)
00309         #Layer init work
00310         marshall = self._props.get('marshall')
00311         if marshall:
00312             self.registerLayer('marshall', marshall)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

Reimplemented in Archetypes.Schema.Schema.

Definition at line 376 of file __init__.py.

00376 
00377     def __add__(self, other):
00378         c = SchemaLayerContainer()
00379         layers = {}
00380         for k, v in self.registeredLayers():
00381             layers[k] = v
00382         for k, v in other.registeredLayers():
00383             layers[k] = v
00384         for k, v in layers.items():
00385             c.registerLayer(k, v)
00386         return c

Here is the call graph for this function:

def Archetypes.Schema.SchemaLayerContainer.cleanupLayers (   self,
  instance,
  item = None,
  container = None 
)

Definition at line 347 of file __init__.py.

00347 
00348     def cleanupLayers(self, instance, item=None, container=None):
00349         # scan each field looking for registered layers optionally
00350         # call its cleanupInstance method and then the cleanupField
00351         # method
00352         queuedLayers = []
00353         queued = lambda x: x in queuedLayers
00354 
00355         for field in self.fields():
00356             if ILayerContainer.isImplementedBy(field):
00357                 layers = field.registeredLayers()
00358                 for layer, obj in layers:
00359                     if not queued((layer, obj)):
00360                         queuedLayers.append((layer, obj))
00361                     if ILayer.isImplementedBy(obj):
00362                         obj.cleanupField(instance, field)
00363 
00364         for layer, obj in queuedLayers:
00365             if ILayer.isImplementedBy(obj):
00366                 obj.cleanupInstance(instance, item, container)
00367 
00368         # Now do the same for objects registered at this level
00369 
00370         if ILayerContainer.isImplementedBy(self):
00371             for layer, obj in self.registeredLayers():
00372                 if (not queued((layer, obj)) and
00373                     ILayer.isImplementedBy(obj)):
00374                     obj.cleanupInstance(instance, item, container)
00375                     queuedLayers.append((layer, obj))

Here is the call graph for this function:

Definition at line 388 of file __init__.py.

00388 
00389     def copy(self):
00390         c = SchemaLayerContainer()
00391         layers = {}
00392         for k, v in self.registeredLayers():
00393             c.registerLayer(k, v)
00394         return c
00395 
00396 InitializeClass(SchemaLayerContainer)
00397 

Here is the call graph for this function:

def Archetypes.Schema.SchemaLayerContainer.initializeLayers (   self,
  instance,
  item = None,
  container = None 
)

Definition at line 316 of file __init__.py.

00316 
00317     def initializeLayers(self, instance, item=None, container=None):
00318         # scan each field looking for registered layers optionally
00319         # call its initializeInstance method and then the
00320         # initializeField method
00321         initializedLayers = []
00322         called = lambda x: x in initializedLayers
00323 
00324         for field in self.fields():
00325             if ILayerContainer.isImplementedBy(field):
00326                 layers = field.registeredLayers()
00327                 for layer, obj in layers:
00328                     if ILayer.isImplementedBy(obj):
00329                         if not called((layer, obj)):
00330                             obj.initializeInstance(instance, item, container)
00331                             # Some layers may have the same name, but
00332                             # different classes, so, they may still
00333                             # need to be initialized
00334                             initializedLayers.append((layer, obj))
00335                         obj.initializeField(instance, field)
00336 
00337         # Now do the same for objects registered at this level
00338         if ILayerContainer.isImplementedBy(self):
00339             for layer, obj in self.registeredLayers():
00340                 if (not called((layer, obj)) and
00341                     ILayer.isImplementedBy(obj)):
00342                     obj.initializeInstance(instance, item, container)
00343                     initializedLayers.append((layer, obj))
00344 

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Initial value:
{
        'marshall' : None
        }

Definition at line 302 of file __init__.py.

tuple Archetypes.Schema.SchemaLayerContainer.security = ClassSecurityInfo() [static]

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