Back to index

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

List of all members.

Public Member Functions

def Schema
def getAndPrepareSchema
def getSchema
def setSchema

Public Attributes

 schema

Static Public Attributes

tuple security = ClassSecurityInfo()

Detailed Description

Mixin class to support instance-based schemas

NOTE: This implementation has been found to be quite slow, because the
hash is expensive to calculate and does not appear to work very well as
a cache key.

Attention: must be before BaseFolder or BaseContent in
the inheritance list, e.g:

class Blorf(VariableSchemaSupport, BaseContent):
    def getSchema():
        return some schema definition...

Definition at line 36 of file VariableSchemaSupport.py.


Member Function Documentation

Definition at line 60 of file VariableSchemaSupport.py.

00060 
00061     def getAndPrepareSchema(self):
00062         s = self.getSchema()
00063 
00064         # create a hash value out of the schema
00065         hash=sha.new(str([f.__dict__ for f in s.values()]) +
00066                      str(self.__class__)).hexdigest()
00067 
00068         if schemadict.has_key(hash): #ok we had that schema already, so take it
00069             schema=schemadict[hash]
00070         else: #make a new one and store it using the hash key
00071             schemadict[hash]=s
00072             schema=schemadict[hash]
00073             g=VarClassGen(schema)
00074             g.updateMethods(self.__class__) #generate the methods
00075 
00076         return schema

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 79 of file VariableSchemaSupport.py.

00079 
00080     def getSchema(self):
00081         return self.schema

Here is the caller graph for this function:

Definition at line 55 of file VariableSchemaSupport.py.

00055 
00056     def Schema(self):
00057         schema = self.getAndPrepareSchema()
00058         return ImplicitAcquisitionWrapper(schema, self)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 83 of file VariableSchemaSupport.py.

00083 
00084     def setSchema(self, schema):
00085         self.schema=schema
00086 
InitializeClass(VariableSchemaSupport)

Member Data Documentation

Definition at line 84 of file VariableSchemaSupport.py.

Definition at line 52 of file VariableSchemaSupport.py.


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