Back to index

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

List of all members.

Public Member Functions

def get
def set
def unset

Static Public Attributes

tuple security = ClassSecurityInfo()

Private Member Functions

def _migration
def _cleanup

Static Private Attributes

 _key = AT_ANN_STORAGE

Detailed Description

Stores values as ATAnnotations on the object

Definition at line 95 of file annotation.py.


Member Function Documentation

def Archetypes.Storage.annotation.AnnotationStorage._cleanup (   self,
  name,
  instance,
  value,
  kwargs 
) [private]
Clean up data in set method

Reimplemented from Archetypes.Storage.annotation.BaseAnnotationStorage.

Definition at line 113 of file annotation.py.

00113 
00114     def _cleanup(self, name, instance, value, **kwargs):
00115         if shasattr(instance, name):
00116             delattr(instance, name)
00117 
00118 registerStorage(AnnotationStorage)

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.Storage.annotation.AnnotationStorage._migration (   self,
  name,
  instance,
  kwargs 
) [private]
Migrates data from the original storage

Reimplemented from Archetypes.Storage.annotation.BaseAnnotationStorage.

Definition at line 103 of file annotation.py.

00103 
00104     def _migration(self, name, instance, **kwargs):
00105         """Migrates data from the original storage
00106         """
00107         value = getattr(aq_base(instance), name, _marker)
00108         if value is _marker:
00109                 raise AttributeError(name)
00110         delattr(instance, name) # explicit del althought set would do the job, too
00111         self.set(name, instance, value, **kwargs)
00112         return value
    

Here is the call graph for this function:

def Archetypes.Storage.annotation.BaseAnnotationStorage.get (   self,
  name,
  instance,
  kwargs 
) [inherited]

Definition at line 66 of file annotation.py.

00066 
00067     def get(self, name, instance, **kwargs):
00068         ann = getAnnotation(instance)
00069         value = ann.getSubkey(self._key, subkey=name, default=_marker)
00070         if value is _marker:
00071             if self._migrate:
00072                 value = self._migration(name, instance, **kwargs)
00073             else:
00074                 raise AttributeError(name)
00075         return value

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.Storage.annotation.BaseAnnotationStorage.set (   self,
  name,
  instance,
  value,
  kwargs 
) [inherited]

Definition at line 77 of file annotation.py.

00077 
00078     def set(self, name, instance, value, **kwargs):
00079         # Remove acquisition wrappers
00080         value = aq_base(value)
00081         ann = getAnnotation(instance)
00082         ann.setSubkey(self._key, value, subkey=name)
00083         if self._migrate:
00084             self._cleanup(name, instance, value, **kwargs) 

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.Storage.annotation.BaseAnnotationStorage.unset (   self,
  name,
  instance,
  kwargs 
) [inherited]

Definition at line 86 of file annotation.py.

00086 
00087     def unset(self, name, instance, **kwargs):
00088         ann = getAnnotation(instance)
00089         try:
00090             ann.delSubkey(self._key, subkey=name)
00091         except KeyError:
00092             pass
00093 
00094 setSecurity(BaseAnnotationStorage)

Here is the call graph for this function:


Member Data Documentation

Archetypes.Storage.annotation.AnnotationStorage._key = AT_ANN_STORAGE [static, private]

Reimplemented from Archetypes.Storage.annotation.BaseAnnotationStorage.

Definition at line 99 of file annotation.py.

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

Reimplemented from Archetypes.Storage.annotation.BaseAnnotationStorage.

Definition at line 101 of file annotation.py.


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