Exemple #1
0
 def _items(self, **query):
     adapter = IAdapter(self.context)
     sort_limit = adapter.get_feed_number(self.interface)
     if sort_limit:
         query['sort_limit'] = sort_limit
         if isinstance(self, BaseNewsEventFeedViewlet):
             query['sort_limit'] += adapter.get_feed_number(
                 ITopPageMainFeed)
     base = IBaseAdapter(self.context)
     res = []
     for item in base.get_content_listing(**query):
         obj = item.getObject()
         if not isinstance(self, BaseNewsEventFeedViewlet) or (
                 ISiteRoot.providedBy(self.context)
                 and not ITopPageFeed.providedBy(obj)) or (
                     not ISiteRoot.providedBy(self.context)
                     and INavigationRoot.providedBy(self.context)
                     and not IMicroSiteFeed.providedBy(obj)):
             parent = aq_parent(aq_inner(obj))
             res.append({
                 'title': item.Title(),
                 'url': item.getURL(),
                 'parent_title': parent.Title(),
                 'parent_url': parent.absolute_url(),
                 'date': self._date(item),
                 'image': self._image(item),
                 'description': self._description(item),
             })
     if sort_limit:
         return res[:sort_limit]
     return res
Exemple #2
0
 def unfeedable_from_microsite(self):
     return (
         IATDocument.providedBy(
             self.context
         ) or IATEvent.providedBy(
             self.context
         ) or IATNewsItem.providedBy(
             self.context
         )
     ) and IMicroSiteFeed.providedBy(self.context)
Exemple #3
0
 def _items(self, **query):
     adapter = IAdapter(self.context)
     sort_limit = adapter.get_feed_number(self.interface)
     if sort_limit:
         query['sort_limit'] = sort_limit
         if isinstance(self, BaseNewsEventFeedViewlet):
             query['sort_limit'] += adapter.get_feed_number(ITopPageMainFeed)
     base = IBaseAdapter(self.context)
     res = []
     for item in base.get_content_listing(**query):
         obj = item.getObject()
         if not isinstance(self, BaseNewsEventFeedViewlet) or (
             ISiteRoot.providedBy(self.context) and not ITopPageFeed.providedBy(obj)) or (
                 not ISiteRoot.providedBy(self.context) and INavigationRoot.providedBy(self.context) and not IMicroSiteFeed.providedBy(obj)):
             parent = aq_parent(aq_inner(obj))
             res.append({
                 'title': item.Title(),
                 'url': item.getURL(),
                 'parent_title': parent.Title(),
                 'parent_url': parent.absolute_url(),
                 'date': self._date(item),
                 'image': self._image(item),
                 'description': self._description(item),
             })
     if sort_limit:
         return res[:sort_limit]
     return res
Exemple #4
0
 def unfeedable_from_microsite(self):
     return (IATDocument.providedBy(self.context)
             or IATEvent.providedBy(self.context) or IATNewsItem.providedBy(
                 self.context)) and IMicroSiteFeed.providedBy(self.context)