Back to index

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

List of all members.

Public Member Functions

def __init__
def __nonzero__
def get
def __getitem__
def keys
def __setitem__
def __delitem__
def set
def getSubkey
def setSubkey
def delSubkey
def hasSubkey
def getObject
def getAnnotationObject

Static Public Attributes

tuple security = ClassSecurityInfo()

Private Attributes

 _obj

Static Private Attributes

 __implements__ = IATAnnotations
 __used_for__ = IATAnnotatable

Detailed Description

Store annotations in the '__annotations__' attribute on a IATAnnotatable
   object.

Definition at line 46 of file annotations.py.


Constructor & Destructor Documentation

Definition at line 56 of file annotations.py.

00056 
00057     def __init__(self, obj):
00058         self._obj = aq_base(obj)

Here is the caller graph for this function:


Member Function Documentation

Definition at line 95 of file annotations.py.

00095 
00096     def __delitem__(self, key):
00097         try:
00098             annotation = self._obj.__annotations__
00099         except AttributeError:
00100             raise KeyError, key
00101 
00102         del annotation[key]

Definition at line 71 of file annotations.py.

00071 
00072     def __getitem__(self, key):
00073         annotations = getattr(self._obj, '__annotations__', None)
00074         if annotations is None:
00075             raise KeyError, key
00076 
00077         return annotations[key]

Here is the caller graph for this function:

Definition at line 61 of file annotations.py.

00061 
00062     def __nonzero__(self):
00063         return bool(getattr(self._obj, '__annotations__', False))

def Archetypes.annotations.ATAnnotations.__setitem__ (   self,
  key,
  value 
)

Definition at line 85 of file annotations.py.

00085 
00086     def __setitem__(self, key, value):
00087         if not isinstance(key, basestring):
00088             raise TypeError('ATAnnotations key must be a string')
00089         try:
00090             annotations = self._obj.__annotations__
00091         except AttributeError:
00092             annotations = self._obj.__annotations__ = OOBTree()
00093 
00094         annotations[key] = value

Here is the caller graph for this function:

def Archetypes.annotations.ATAnnotations.delSubkey (   self,
  key,
  subkey 
)
Removes a subkey

Definition at line 126 of file annotations.py.

00126 
00127     def delSubkey(self, key, subkey):
00128         """Removes a subkey
00129         """
00130         if isinstance(subkey, basestring):
00131             k = '%s-%s' % (key, subkey)
00132             del self[k]
00133         else:
00134             raise TypeError('Invalid subkey type %s, must be string type' % type(subkey))

def Archetypes.annotations.ATAnnotations.get (   self,
  key,
  default = None 
)

Definition at line 64 of file annotations.py.

00064 
00065     def get(self, key, default=None):
00066         annotations = getattr(self._obj, '__annotations__', None)
00067         if not annotations:
00068             return default
00069 
00070         return annotations.get(key, default)

Here is the caller graph for this function:

Definition at line 147 of file annotations.py.

00147 
00148     def getAnnotationObject(self):
00149         try:
00150             return self._obj.__annotations__
00151         except AttributeError:
00152             return None

Definition at line 144 of file annotations.py.

00144 
00145     def getObject(self):
00146         return self._obj
        

Here is the caller graph for this function:

def Archetypes.annotations.ATAnnotations.getSubkey (   self,
  key,
  subkey,
  default = None 
)
Get annotations using a key and onesubkey

Definition at line 108 of file annotations.py.

00108 
00109     def getSubkey(self, key, subkey, default=None):
00110         """Get annotations using a key and onesubkey
00111         """
00112         if isinstance(subkey, basestring):
00113             k = '%s-%s' % (key, subkey)
00114             return self.get(k, default)
00115         else:
00116             raise TypeError('Invalid subkey type %s, must be string type' % type(subkey))

Here is the call graph for this function:

def Archetypes.annotations.ATAnnotations.hasSubkey (   self,
  key,
  subkey 
)
Checks for the existence of a sub key

Definition at line 135 of file annotations.py.

00135 
00136     def hasSubkey(self, key, subkey):
00137         """Checks for the existence of a sub key
00138         """
00139         if isinstance(subkey, basestring):
00140             k = '%s-%s' % (key, subkey)
00141             return self.has_key(k)
00142         else:
00143             raise TypeError('Invalid subkey type %s, must be string type' % type(subkey))

Here is the call graph for this function:

Definition at line 78 of file annotations.py.

00078 
00079     def keys(self):
00080         annotations = getattr(self._obj, '__annotations__', None)
00081         if annotations is None:
00082             return []
00083 
00084         return annotations.keys()

Here is the caller graph for this function:

def Archetypes.annotations.ATAnnotations.set (   self,
  key,
  value 
)

Definition at line 105 of file annotations.py.

00105 
00106     def set(self, key, value):
00107         self[key] = value

Here is the caller graph for this function:

def Archetypes.annotations.ATAnnotations.setSubkey (   self,
  key,
  value,
  subkey 
)
Stores data using a key and one subkey

Definition at line 117 of file annotations.py.

00117 
00118     def setSubkey(self, key, value, subkey):
00119         """Stores data using a key and one subkey
00120         """
00121         if isinstance(subkey, basestring):
00122             k = '%s-%s' % (key, subkey)
00123             self[k] = value
00124         else:
00125             raise TypeError('Invalid subkey type %s, must be string type' % type(subkey))


Member Data Documentation

Archetypes.annotations.ATAnnotations.__implements__ = IATAnnotations [static, private]

Definition at line 50 of file annotations.py.

Archetypes.annotations.ATAnnotations.__used_for__ = IATAnnotatable [static, private]

Definition at line 51 of file annotations.py.

Definition at line 57 of file annotations.py.

tuple Archetypes.annotations.ATAnnotations.security = ClassSecurityInfo() [static]

Definition at line 53 of file annotations.py.


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