Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes
plone.fieldsets.fieldsets.FormFieldsets Class Reference
Inheritance diagram for plone.fieldsets.fieldsets.FormFieldsets:
Inheritance graph
[legend]
Collaboration diagram for plone.fieldsets.fieldsets.FormFieldsets:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __add__

Public Attributes

 fieldsets

Static Public Attributes

string id = ''
 label = None
 description = None
tuple fieldsets = ()

Private Attributes

 __FormFields_seq__
 __FormFields_byname__

Detailed Description

Let's make sure that this implementation actually fulfills the API.

  >>> from zope.interface.verify import verifyClass
  >>> verifyClass(IFormFieldsets, FormFieldsets)
  True

Definition at line 11 of file fieldsets.py.


Constructor & Destructor Documentation

def plone.fieldsets.fieldsets.FormFieldsets.__init__ (   self,
  args,
  kw 
)

Definition at line 27 of file fieldsets.py.

00027 
00028     def __init__(self, *args, **kw):
00029         # Most of this code is copied from zope.formlib.form.Formfields
00030         # licensed under the ZPL 2.1
00031         keep_readonly, omit_readonly, defaults = _initkw(**kw)
00032 
00033         fields = []
00034         fieldsets = ()
00035         for arg in args:
00036             if isinstance(arg, InterfaceClass):
00037                 for name, field in getFieldsInOrder(arg):
00038                     fields.append((name, field))
00039             elif IField.providedBy(arg):
00040                 name = arg.__name__
00041                 if not name:
00042                     raise ValueError("Field has no name")
00043                 fields.append((name, arg))
00044             elif isinstance(arg, FormFieldsets):
00045                 fieldsets = fieldsets + (arg, )
00046                 for form_field in arg:
00047                     fields.append((form_field.__name__, form_field))
00048             elif isinstance(arg, FormFields):
00049                 for form_field in arg:
00050                     fields.append((form_field.__name__, form_field))
00051             elif isinstance(arg, FormField):
00052                 fields.append((arg.__name__, arg))
00053             else:
00054                 raise TypeError("Unrecognized argument type", arg)
00055 
00056         self.fieldsets = fieldsets
00057 
00058         seq = []
00059         byname = {}
00060         for name, field in fields:
00061             if isinstance(field, FormField):
00062                 form_field = field
00063             else:
00064                 if field.readonly:
00065                     if omit_readonly and (name not in keep_readonly):
00066                         continue
00067                 form_field = FormField(field, **defaults)
00068                 name = form_field.__name__
00069 
00070             if name in byname:
00071                 raise ValueError("Duplicate name", name)
00072             seq.append(form_field)
00073             byname[name] = form_field
00074 
00075         self.__FormFields_seq__ = seq
00076         self.__FormFields_byname__ = byname

Here is the caller graph for this function:


Member Function Documentation

Definition at line 77 of file fieldsets.py.

00077 
00078     def __add__(self, other):
00079         if not isinstance(other, FormFieldsets) and \
00080            not isinstance(other, FormFields):
00081             return NotImplemented
00082         return self.__class__(self, other)

Member Data Documentation

Definition at line 75 of file fieldsets.py.

Definition at line 74 of file fieldsets.py.

Definition at line 24 of file fieldsets.py.

Definition at line 25 of file fieldsets.py.

Definition at line 55 of file fieldsets.py.

Definition at line 22 of file fieldsets.py.

Definition at line 23 of file fieldsets.py.


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