When IntefaceObjectIO updates from an external representation should it respect the order of the field? If dependent fields exist, for example a Choice field whose vocabulary is an IContextSourceBinder whose implementation depends on another field value, properly updating the object becomes order dependent. For example something like this pseudo code setup:
STATES = SimpleVocabulary(
[SimpleTerm(u'TX'),
SimpleTerm(u'OK')])
TX_CITIES = SimpleVocabulary(
[SimpleTerm(u'Dallas'),
SimpleTerm(u'Austin')])
OK_CITIES = SimpleVocabulary(
[SimpleTerm(u'Norman'),
SimpleTerm(u'Tulsa')])
def city_vocab_finder(home_location):
if home_location.state == 'TX':
return TX_CITIES
elif home_location.state == 'OK':
return OK_CITIES
return SimpleVocabulary()
interface.alsoProvides(city_vocab_finder, IContextSourceBinder)
class IHomeLocation(interface.Interface):
state = Choice(title=u'The state you are from',
vocabulary=STATES,
required=True)
city = Choice(title=u'The city you are from',
vocabulary=city_vocab_finder,
required=True)
zope.schema.interfaces.IField defines an order property. That is respected by createFieldProperties and createDirectFieldProperties. Can an argument be made that internalization should also respect it? If not by default should there be a way to enable respecting it?
Should this use case be solved in another way entirely?
When
IntefaceObjectIOupdates from an external representation should it respect the order of the field? If dependent fields exist, for example aChoicefield whose vocabulary is anIContextSourceBinderwhose implementation depends on another field value, properly updating the object becomes order dependent. For example something like this pseudo code setup:zope.schema.interfaces.IFielddefines anorderproperty. That is respected bycreateFieldPropertiesandcreateDirectFieldProperties. Can an argument be made that internalization should also respect it? If not by default should there be a way to enable respecting it?Should this use case be solved in another way entirely?