Skip to content

Commit

Permalink
use zope.schema.getFields instead of zope.schema.getFieldNames
Browse files Browse the repository at this point in the history
  • Loading branch information
agroszer committed Feb 20, 2016
1 parent f98fce6 commit 47db5ea
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/z3c/form/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ def toWidgetValue(self, value):
retval = ObjectWidgetValue()
retval.originalValue = value

for name in zope.schema.getFieldNamesInOrder(self.field.schema):
field = self.field.schema[name]

for name, field in zope.schema.getFieldsInOrder(self.field.schema):
dm = zope.component.getMultiAdapter(
(value, field), interfaces.IDataManager)
subv = dm.query()
Expand Down Expand Up @@ -143,8 +141,7 @@ def toFieldValue(self, value):
obj = self.adapted_obj(obj)

names = []
for name in zope.schema.getFieldNamesInOrder(self.field.schema):
field = self.field.schema[name]
for name, field in zope.schema.getFieldsInOrder(self.field.schema):
if not field.readonly:
try:
newvalRaw = value[name]
Expand All @@ -158,12 +155,10 @@ def toFieldValue(self, value):
newval = converter.toFieldValue(newvalRaw)

dm = zope.component.getMultiAdapter(
(obj, self.field.schema[name]), interfaces.IDataManager)
(obj, field), interfaces.IDataManager)
oldval = dm.query()
if (oldval != newval
or zope.schema.interfaces.IObject.providedBy(
self.field.schema[name])
):
or zope.schema.interfaces.IObject.providedBy(field)):
dm.set(newval)
names.append(name)

Expand Down

0 comments on commit 47db5ea

Please sign in to comment.