File indexing completed on 2026-12-02 10:29:07
0001 """The What's new RSS feed (docs/WHATS_NEW.md, The feed).
0002
0003 RSS 2.0, newest shipped first, from the same list the page shows. Links
0004 point at the face the reader came through: epic-devcloud.org for a
0005 request through the swf-remote proxy, the monitor's own address
0006 otherwise.
0007 """
0008 from datetime import datetime, time
0009 from zoneinfo import ZoneInfo
0010
0011 from django.contrib.syndication.views import Feed
0012 from django.urls import reverse
0013
0014 from monitor_app.middleware import is_tunnel_request
0015 from monitor_app.models import external_face_base_url
0016
0017 from . import whats_new as wn
0018
0019 ITEMS = 50
0020 _EASTERN = ZoneInfo('America/New_York')
0021
0022
0023 class WhatsNewFeed(Feed):
0024 title = "What's new in ePIC workflow and production"
0025 description = ('Developments in the ePIC workflow and production system '
0026 'that users, operators and developers should know about, '
0027 'newest first.')
0028
0029
0030
0031 def get_object(self, request, *args, **kwargs):
0032 return request
0033
0034 @staticmethod
0035 def _url(request, name, *args):
0036 path = reverse(name, args=args)
0037 if is_tunnel_request(request):
0038
0039 script = request.META.get('SCRIPT_NAME', '')
0040 if script and path.startswith(script):
0041 path = path[len(script):]
0042 return f"{external_face_base_url().rstrip('/')}/prod{path}"
0043 return request.build_absolute_uri(path)
0044
0045 def link(self, request):
0046 return self._url(request, 'help:whats_new')
0047
0048 def feed_url(self, request):
0049 return self._url(request, 'help:whats_new_feed')
0050
0051 def items(self, request):
0052 rows = wn.list_items()[:ITEMS]
0053 for row in rows:
0054 row['link'] = self._url(request, 'help:whats_new_item', row['slug'])
0055 return rows
0056
0057 def item_title(self, item):
0058 return item['title']
0059
0060 def item_description(self, item):
0061 level = wn.IMPORTANCE_LABELS.get(item['importance'], item['importance'])
0062 return (f"{item['summary']}\n\nImportance: {level}. "
0063 f"Tags: {' '.join(item['tags'])}. Contact: {item['contact']}.")
0064
0065 def item_link(self, item):
0066 return item['link']
0067
0068 def item_pubdate(self, item):
0069 return datetime.combine(datetime.fromisoformat(item['shipped']).date(),
0070 time(12, 0), tzinfo=_EASTERN)
0071
0072 def item_categories(self, item):
0073 return item['tags']