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
Ejemplo n.º 2
0
        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)
Ejemplo n.º 3
0
        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)
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
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