Back to index

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

List of all members.

Public Member Functions

def getName
def __add__
def copy
def fields
def editableFields
def viewableFields
def widgets
def filterFields
def __setitem__
def addField
def __delitem__
def __getitem__
def get
def has_key
def keys
def searchable
def hasPrimary

Static Public Attributes

tuple security = ClassSecurityInfo()
 values = fields
 delField = __delitem__
 updateField = addField

Detailed Description

Wrapped Schemata

Definition at line 285 of file __init__.py.


Member Function Documentation

def Archetypes.Schema.Schemata.__add__ (   self,
  other 
) [inherited]
Returns a new Schemata object that contains all fields and layers
from ``self`` and ``other``.

Reimplemented in Archetypes.Schema.Schema, and Archetypes.Schema.BasicSchema.

Definition at line 73 of file __init__.py.

00073 
00074     def __add__(self, other):
00075         """Returns a new Schemata object that contains all fields and layers
00076         from ``self`` and ``other``.
00077         """
00078 
00079         c = Schemata()
00080         for field in self.fields():
00081             c.addField(field)
00082         for field in other.fields():
00083             c.addField(field)
00084 
00085         return c
00086 

Here is the call graph for this function:

def Archetypes.Schema.Schemata.__delitem__ (   self,
  name 
) [inherited]

Definition at line 226 of file __init__.py.

00226 
00227     def __delitem__(self, name):
00228         if not self._fields.has_key(name):
00229             raise KeyError("Schemata has no field '%s'" % name)
00230         del self._fields[name]
00231         self._names.remove(name)

def Archetypes.Schema.Schemata.__getitem__ (   self,
  name 
) [inherited]

Definition at line 232 of file __init__.py.

00232 
00233     def __getitem__(self, name):
00234         return self._fields[name]

Here is the caller graph for this function:

def Archetypes.Schema.Schemata.__setitem__ (   self,
  name,
  field 
) [inherited]

Definition at line 174 of file __init__.py.

00174 
00175     def __setitem__(self, name, field):
00176         assert name == field.getName()
00177         self.addField(field)

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.Schema.Schemata.addField (   self,
  field 
) [inherited]
Adds a given field to my dictionary of fields.

Reimplemented in Archetypes.Schema.MetadataSchema.

Definition at line 180 of file __init__.py.

00180 
00181     def addField(self, field):
00182         """Adds a given field to my dictionary of fields."""
00183         field = aq_base(field)
00184         self._validateOnAdd(field)
00185         name = field.getName()
00186         if name not in self._names:
00187             self._names.append(name)
00188         self._fields[name] = field

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.Schema.Schemata.copy (   self) [inherited]
Returns a deep copy of this Schemata.

Reimplemented in Archetypes.Schema.BasicSchema.

Definition at line 88 of file __init__.py.

00088 
00089     def copy(self):
00090         """Returns a deep copy of this Schemata.
00091         """
00092         c = Schemata()
00093         for field in self.fields():
00094             c.addField(field.copy())
00095         return c
00096 

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.Schema.Schemata.editableFields (   self,
  instance,
  visible_only = False 
) [inherited]
Returns a list of editable fields for the given instance

Definition at line 107 of file __init__.py.

00107 
00108     def editableFields(self, instance, visible_only=False):
00109         """Returns a list of editable fields for the given instance
00110         """
00111         ret = []
00112         for field in self.fields():
00113             if field.writeable(instance, debug=False) and    \
00114                    (not visible_only or
00115                     field.widget.isVisible(instance, 'edit') != 'invisible'):
00116                 ret.append(field)
00117         return ret

Here is the call graph for this function:

def Archetypes.Schema.Schemata.fields (   self) [inherited]
Returns a list of my fields in order of their indices.

Definition at line 98 of file __init__.py.

00098 
00099     def fields(self):
00100         """Returns a list of my fields in order of their indices."""
00101         return [self._fields[name] for name in self._names]
00102 

Here is the caller graph for this function:

def Archetypes.Schema.Schemata.filterFields (   self,
  predicates,
  values 
) [inherited]
Returns a subset of self.fields(), containing only fields that
satisfy the given conditions.

You can either specify predicates or values or both. If you provide
both, all conditions must be satisfied.

For each ``predicate`` (positional argument), ``predicate(field)`` must
return 1 for a Field ``field`` to be returned as part of the result.

Each ``attr=val`` function argument defines an additional predicate:
A field must have the attribute ``attr`` and field.attr must be equal
to value ``val`` for it to be in the returned list.

Definition at line 137 of file __init__.py.

00137 
00138     def filterFields(self, *predicates, **values):
00139         """Returns a subset of self.fields(), containing only fields that
00140         satisfy the given conditions.
00141 
00142         You can either specify predicates or values or both. If you provide
00143         both, all conditions must be satisfied.
00144 
00145         For each ``predicate`` (positional argument), ``predicate(field)`` must
00146         return 1 for a Field ``field`` to be returned as part of the result.
00147 
00148         Each ``attr=val`` function argument defines an additional predicate:
00149         A field must have the attribute ``attr`` and field.attr must be equal
00150         to value ``val`` for it to be in the returned list.
00151         """
00152 
00153         results = []
00154 
00155         for field in self.fields(): # step through each of my fields
00156 
00157             # predicate failed:
00158             failed = [pred for pred in predicates if not pred(field)]
00159             if failed: continue
00160 
00161             # attribute missing:
00162             missing_attrs = [attr for attr in values.keys() \
00163                              if not shasattr(field, attr)]
00164             if missing_attrs: continue
00165 
00166             # attribute value unequal:
00167             diff_values = [attr for attr in values.keys() \
00168                            if getattr(field, attr) != values[attr]]
00169             if diff_values: continue
00170 
00171             results.append(field)
00172 
00173         return results

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.Schema.Schemata.get (   self,
  name,
  default = None 
) [inherited]

Definition at line 236 of file __init__.py.

00236 
00237     def get(self, name, default=None):
00238         return self._fields.get(name, default)

Here is the caller graph for this function:

def Archetypes.Schema.Schemata.getName (   self) [inherited]
Returns the Schemata's name.

Definition at line 68 of file __init__.py.

00068 
00069     def getName(self):
00070         """Returns the Schemata's name."""
00071         return self.__name__
00072 

Here is the caller graph for this function:

def Archetypes.Schema.Schemata.has_key (   self,
  name 
) [inherited]

Definition at line 240 of file __init__.py.

00240 
00241     def has_key(self, name):
00242         return self._fields.has_key(name)

Here is the caller graph for this function:

def Archetypes.Schema.Schemata.hasPrimary (   self) [inherited]
Returns the first primary field or False

Definition at line 263 of file __init__.py.

00263 
00264     def hasPrimary(self):
00265         """Returns the first primary field or False"""
00266         for f in self.fields():
00267             if getattr(f, 'primary', False):
00268                 return f
00269         return False

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.Schema.Schemata.keys (   self) [inherited]

Definition at line 246 of file __init__.py.

00246 
00247     def keys(self):
00248         return self._names

Here is the caller graph for this function:

def Archetypes.Schema.Schemata.searchable (   self) [inherited]
Returns a list containing names of all searchable fields.

Definition at line 258 of file __init__.py.

00258 
00259     def searchable(self):
00260         """Returns a list containing names of all searchable fields."""
00261 
00262         return [f.getName() for f in self.fields() if f.searchable]

Here is the call graph for this function:

def Archetypes.Schema.Schemata.viewableFields (   self,
  instance 
) [inherited]
Returns a list of viewable fields for the given instance

Definition at line 119 of file __init__.py.

00119 
00120     def viewableFields(self, instance):
00121         """Returns a list of viewable fields for the given instance
00122         """
00123         return [field for field in self.fields()
00124                 if field.checkPermission('view', instance)]

Here is the call graph for this function:

def Archetypes.Schema.Schemata.widgets (   self) [inherited]
Returns a dictionary that contains a widget for
each field, using the field name as key.

Definition at line 126 of file __init__.py.

00126 
00127     def widgets(self):
00128         """Returns a dictionary that contains a widget for
00129         each field, using the field name as key."""
00130 
00131         widgets = {}
00132         for f in self.fields():
00133             widgets[f.getName()] = f.widget
00134         return widgets

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 251 of file __init__.py.

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

Reimplemented from Archetypes.Schema.Schemata.

Definition at line 290 of file __init__.py.

Definition at line 255 of file __init__.py.

Definition at line 104 of file __init__.py.


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