How to access directly fields and widgets from an Archetypes content

There are two ways to access the field values and widgets from inside an AT content item.

First, a more complex example on getting fields and widgets properties using self.schema:

for fname in self.schema.keys():
    field = self.schema.get(fname)
    widget = field.widget
    widgetLabel = widget.Label(self)
    fieldValue = field.get(self))

To get a field value, one could use

 self.schema['customer_copy_to'].get(self)

The second way uses self.Schema() and shows the equivalent of the above example

self.Schema().getField('customer_copy_to').get(self)

Of course, there's always the default generated AT getters, but sometimes it's not possible to use those (for example, when you want to get the raw value of a field.

Comments