Back to index

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

List of all members.

Public Member Functions

def initializeInstance
def initializeField
def get
def set
def unset
def cleanupField
def cleanupInstance
def cleanupField
def getName
def __repr__
def __cmp__

Static Public Attributes

tuple security = ClassSecurityInfo()

Static Private Attributes

 __implements__ = IStorage,ILayer

Detailed Description

Storage used for ExtensibleMetadata. Attributes are stored on
a persistent mapping named ``_md`` on the instance.

Definition at line 146 of file __init__.py.


Member Function Documentation

def Archetypes.Storage.Storage.__cmp__ (   self,
  other 
) [inherited]

Definition at line 36 of file __init__.py.

00036 
00037     def __cmp__(self, other):
00038         return cmp(self.getName(), other.getName())

Here is the call graph for this function:

def Archetypes.Storage.Storage.__repr__ (   self) [inherited]

Definition at line 33 of file __init__.py.

00033 
00034     def __repr__(self):
00035         return "<Storage %s>" % (self.getName())

Here is the call graph for this function:

def Archetypes.Storage.StorageLayer.cleanupField (   self,
  instance,
  field 
) [inherited]

Definition at line 81 of file __init__.py.

00081 
00082     def cleanupField(self, instance, field):
00083         raise NotImplementedError('%s: cleanupField' % self.getName())
00084 
00085 setSecurity(StorageLayer)

Here is the call graph for this function:

def Archetypes.Storage.MetadataStorage.cleanupField (   self,
  instance,
  field,
  kwargs 
)

Definition at line 199 of file __init__.py.

00199 
00200     def cleanupField(self, instance, field, **kwargs):
00201         # Don't clean up the field self to avoid problems with copy/rename. The
00202         # python garbarage system will clean up if needed.
00203         pass

def Archetypes.Storage.MetadataStorage.cleanupInstance (   self,
  instance,
  item = None,
  container = None 
)

Reimplemented from Archetypes.Storage.StorageLayer.

Definition at line 205 of file __init__.py.

00205 
00206     def cleanupInstance(self, instance, item=None, container=None):
00207         # Don't clean up the instance self to avoid problems with copy/rename. The
00208         # python garbarage system will clean up if needed.
00209         pass

def Archetypes.Storage.MetadataStorage.get (   self,
  name,
  instance,
  kwargs 
)

Reimplemented from Archetypes.Storage.Storage.

Definition at line 170 of file __init__.py.

00170 
00171     def get(self, name, instance, **kwargs):
00172         base = aq_base(instance)
00173         try:
00174             value = base._md[name]
00175         except KeyError, msg:
00176             # We are acting like an attribute, so
00177             # raise AttributeError instead of KeyError
00178             raise AttributeError(name, msg)
00179         return value

Here is the caller graph for this function:

def Archetypes.Storage.Storage.getName (   self) [inherited]

Definition at line 30 of file __init__.py.

00030 
00031     def getName(self):
00032         return self.__class__.__name__

Here is the caller graph for this function:

def Archetypes.Storage.MetadataStorage.initializeField (   self,
  instance,
  field 
)

Reimplemented from Archetypes.Storage.StorageLayer.

Definition at line 161 of file __init__.py.

00161 
00162     def initializeField(self, instance, field):
00163         # Check for already existing field to avoid  the reinitialization
00164         # (which means overwriting) of an already existing field after a
00165         # copy or rename operation
00166         base = aq_base (instance)
00167         if not base._md.has_key(field.getName()):
00168             self.set(field.getName(), instance, field.getDefault(instance))

Here is the call graph for this function:

def Archetypes.Storage.MetadataStorage.initializeInstance (   self,
  instance,
  item = None,
  container = None 
)

Reimplemented from Archetypes.Storage.StorageLayer.

Definition at line 155 of file __init__.py.

00155 
00156     def initializeInstance(self, instance, item=None, container=None):
00157         if not shasattr(instance, "_md"):
00158             instance._md = PersistentMapping()
00159             instance._p_changed = 1

Here is the call graph for this function:

def Archetypes.Storage.MetadataStorage.set (   self,
  name,
  instance,
  value,
  kwargs 
)

Reimplemented from Archetypes.Storage.Storage.

Definition at line 181 of file __init__.py.

00181 
00182     def set(self, name, instance, value, **kwargs):
00183         base = aq_base(instance)
00184         # Remove acquisition wrappers
00185         if not hasattr(base,'_md'):
00186                    base._md=PersistentMapping()
00187 
00188         base._md[name] = aq_base(value)
00189         base._p_changed = 1

Here is the caller graph for this function:

def Archetypes.Storage.MetadataStorage.unset (   self,
  name,
  instance,
  kwargs 
)

Reimplemented from Archetypes.Storage.Storage.

Definition at line 191 of file __init__.py.

00191 
00192     def unset(self, name, instance, **kwargs):
00193         if not shasattr(instance, "_md"):
00194             log("Broken instance %s, no _md" % instance)
00195         else:
00196             del instance._md[name]
00197             instance._p_changed = 1

Here is the call graph for this function:


Member Data Documentation

Archetypes.Storage.MetadataStorage.__implements__ = IStorage,ILayer [static, private]

Reimplemented from Archetypes.Storage.StorageLayer.

Definition at line 150 of file __init__.py.

tuple Archetypes.Storage.MetadataStorage.security = ClassSecurityInfo() [static]

Reimplemented from Archetypes.Storage.StorageLayer.

Definition at line 152 of file __init__.py.


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