def has_image(obj): try: # check if brain has the data return obj.hasImage except: if getattr(obj, 'getObject', False): obj = obj.getObject() if IHasDefaultImage.providedBy(obj): return True try: return getattr(aq_base(obj), 'image', None) except POSKeyError: return False
def hasImage(obj): if IHasDefaultImage.providedBy(obj): return True return getattr(aq_base(obj), 'image', None) is not None