Iterating over Plone Dexterity fields

To get all related schemas for your object, you can use the iterSchemata function provided by plone.dexterity.utils. From the list of schematas you can get the fields by using the getFields function provided by zope.schema.

from plone.dexterity.utils import iterSchemata
from zope.schema import getFields

fields = {}
schemes = iterSchemata(context)
for schema in schemes:

for name, field in fields.items():
    print("Field: {0}, value: {1}".format(name, field))
By @MrTango in
Tags :