@staticmethod
    def fromDict(fieldDict):
        """
        Create a field from a dictionary.

        This is a short hand for passing arguments directly on Field object
        creation. The field type is represented by the C{'type'} key. For
        C{'options'} the value is not a list of L{Option}s, but a dictionary
        keyed by value, with an optional label as value.
        """
        kwargs = fieldDict.copy()

        if 'type' in fieldDict:
            kwargs['fieldType'] = fieldDict['type']
            del kwargs['type']

        if 'options' in fieldDict:
            options = []
            for value, label in fieldDict['options'].iteritems():
                options.append(Option(value, label))
            kwargs['options'] = options

        return Field(**kwargs)
dataset/ETHPy150Open ralphm/wokkel/wokkel/data_form.py/Field.fromDict/original