def hasImage(obj, **kwargs): """ Get image url """ if not IRSSNewsItem.providedBy(obj): raise AttributeError try: image = obj.getField('image').getAccessor(obj)() except Exception: raise AttributeError else: return True if image else False
def sourceUrl(obj, **kwargs): """ Index source url """ if not IRSSNewsItem.providedBy(obj): raise AttributeError try: url = obj.getField('url').getAccessor(obj)() except Exception: raise AttributeError else: return url
def sourceTitle(obj, **kwargs): """ Get source for catalog index """ if not IRSSNewsItem.providedBy(obj): raise AttributeError found = False myparent = parent(obj) for _back in range(0, 5): if IRSSServer.providedBy(myparent): found = True break myparent = parent(myparent) if not found: raise AttributeError return myparent.title_or_id()