392 |
392 |
393 def form_field_value(self, field, load_bytes=False): |
393 def form_field_value(self, field, load_bytes=False): |
394 """return field's *typed* value |
394 """return field's *typed* value |
395 |
395 |
396 overriden to deal with |
396 overriden to deal with |
397 * special eid / __type / edits- / edito- fields |
397 * special eid / __type |
398 * lookup for values on edited entities |
398 * lookup for values on edited entities |
399 """ |
399 """ |
400 attr = field.name |
400 attr = field.name |
401 entity = self.edited_entity |
401 entity = self.edited_entity |
402 if attr == 'eid': |
402 if attr == 'eid': |
403 return entity.eid |
403 return entity.eid |
404 if not field.eidparam: |
404 if not field.eidparam: |
405 return super(EntityFieldsForm, self).form_field_value(field, load_bytes) |
405 return super(EntityFieldsForm, self).form_field_value(field, load_bytes) |
406 if attr.startswith('edits-') or attr.startswith('edito-'): |
|
407 # edit[s|o]- fieds must have the actual value stored on the entity |
|
408 assert hasattr(field, 'visible_field') |
|
409 vfield = field.visible_field |
|
410 assert vfield.eidparam |
|
411 if entity.has_eid(): |
|
412 return self.form_field_value(vfield) |
|
413 return INTERNAL_FIELD_VALUE |
|
414 if attr == '__type': |
406 if attr == '__type': |
415 return entity.id |
407 return entity.id |
416 if self.schema.rschema(attr).is_final(): |
408 if self.schema.rschema(attr).is_final(): |
417 attrtype = entity.e_schema.destination(attr) |
409 attrtype = entity.e_schema.destination(attr) |
418 if attrtype == 'Password': |
410 if attrtype == 'Password': |