def _image_field_info(self): fields = [] for fieldname in self.context.getTypeInfo().lookupSchema(): img_field = getattr(self.context, fieldname, None) if img_field and IImage.providedBy(img_field): fields.append((fieldname, img_field)) return fields
def _image_field_info(self): type_info = self.context.getTypeInfo() schema = type_info.lookupSchema() fields = getFieldsInOrder(schema) behavior_assignable = IBehaviorAssignable(self.context) if behavior_assignable: behaviors = behavior_assignable.enumerateBehaviors() for behavior in behaviors: fields += getFieldsInOrder(behavior.interface) for fieldname, field in fields: img_field = getattr(self.context, fieldname, None) if img_field and IImage.providedBy(img_field): yield (fieldname, img_field)
def _image_field_values(self): for fieldname, field in self._all_fields(): value = getattr(self.context, fieldname, None) if value and IImage.providedBy(value): yield (fieldname, value)
def get_image_fields(obj): for fieldname, field in get_all_fields(obj): value = getattr(obj, fieldname, None) if value and IImage.providedBy(value): yield fieldname