def makeFields(self, values, fieldDefs=None, filterUnknown=True):
        """
        Create fields from values and add them to this form.

        This creates fields from a mapping of name to value(s) and adds them to
        this form. It is typically used for generating outgoing forms.

        If C{fieldDefs} is not C{None}, this is used to fill in
        additional properties of fields, like the field types, labels and
        possible options.

        If C{filterUnknown} is C{True} and C{fieldDefs} is not C{None}, fields
        will only be created from C{values} with a corresponding entry in
        C{fieldDefs}.

        If the field type is unknown, the field type is C{None}. When the form
        is rendered using L{toElement}, these fields will have no C{'type'}
        attribute, and it is up to the receiving party to interpret the values
        properly (e.g. by knowing about the FORM_TYPE in C{formNamespace} and
        the field name).

        @param values: Values to create fields from.
        @type values: C{dict}

        @param fieldDefs: Field definitions as a dictionary. See
            L{wokkel.iwokkel.IPubSubService.getConfigurationOptions}
        @type fieldDefs: C{dict}

        @param filterUnknown: If C{True}, ignore fields that are not in
            C{fieldDefs}.
        @type filterUnknown: C{bool}
        """
        for name, value in values.iteritems():
            fieldDict = {'var': name,
                         'type': None}

            if fieldDefs is not None:
                if name in fieldDefs:
                    fieldDict.update(fieldDefs[name])
                elif filterUnknown:
                    continue

            if isinstance(value, list):
                fieldDict['values'] = value
            else:
                fieldDict['value'] = value

            self.addField(Field.fromDict(fieldDict))
dataset/ETHPy150Open ralphm/wokkel/wokkel/data_form.py/Form.makeFields/original