We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
https://zestedesavoir.com/forums/flux/sujets/rss/ retourne une erreur 500
**Description du bug**

les rss des sujets ont l'air morts

https://zestedesavoir.com/forums/flux/sujets/rss/

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `zds/tutorialv2/feeds.py`
Content:
```
1 from django.conf import settings
2 from django.contrib.syndication.views import Feed
3 from django.shortcuts import get_object_or_404
4 from django.utils.feedgenerator import Atom1Feed
5 from django.utils.translation import gettext_lazy as _
6 
7 from zds.utils.models import Category, SubCategory, Tag
8 from zds.utils.uuslug_wrapper import slugify
9 from zds.tutorialv2.models.database import PublishedContent
10 
11 
12 class LastContentFeedRSS(Feed):
13     """
14     RSS feed for any type of content.
15     """
16 
17     title = _("Contenus sur {}").format(settings.ZDS_APP["site"]["literal_name"])
18     description = _("Les derniers contenus parus sur {}.").format(settings.ZDS_APP["site"]["literal_name"])
19     link = ""
20     content_type = None
21     query_params = {}
22 
23     def get_object(self, request, *args, **kwargs):
24         self.query_params = request.GET
25         return super().get_object(request, *args, **kwargs)
26 
27     def items(self):
28         """
29         :return: The last (typically 5) contents (sorted by publication date).
30         """
31         subcategories = None
32         category = self.query_params.get("category", "").strip()
33         if category:
34             category = get_object_or_404(Category, slug=category)
35             subcategories = category.get_subcategories()
36         subcategory = self.query_params.get("subcategory", "").strip()
37         if subcategory:
38             subcategories = [get_object_or_404(SubCategory, slug=subcategory)]
39 
40         tags = None
41         tag = self.query_params.get("tag", "").strip()
42         if tag:
43             tags = [get_object_or_404(Tag, slug=slugify(self.query_params.get("tag")))]
44 
45         feed_length = settings.ZDS_APP["content"]["feed_length"]
46 
47         contents = PublishedContent.objects.last_contents(
48             content_type=[self.content_type], subcategories=subcategories, tags=tags
49         )[:feed_length]
50 
51         return contents
52 
53     def item_title(self, item):
54         return item.content.title
55 
56     def item_pubdate(self, item):
57         return item.publication_date
58 
59     def item_description(self, item):
60         return item.content.description
61 
62     def item_author_name(self, item):
63         authors_list = item.content.authors.all()
64         authors = []
65         for authors_obj in authors_list:
66             authors.append(authors_obj.username)
67         authors = ", ".join(authors)
68         return authors
69 
70     def item_link(self, item):
71         return item.get_absolute_url_online()
72 
73 
74 class LastContentFeedATOM(LastContentFeedRSS):
75     feed_type = Atom1Feed
76     subtitle = LastContentFeedRSS.description
77 
78 
79 class LastTutorialsFeedRSS(LastContentFeedRSS):
80     """
81     Redefinition of `LastContentFeedRSS` for tutorials only
82     """
83 
84     content_type = "TUTORIAL"
85     link = "/tutoriels/"
86     title = _("Tutoriels sur {}").format(settings.ZDS_APP["site"]["literal_name"])
87     description = _("Les derniers tutoriels parus sur {}.").format(settings.ZDS_APP["site"]["literal_name"])
88 
89 
90 class LastTutorialsFeedATOM(LastTutorialsFeedRSS):
91     feed_type = Atom1Feed
92     subtitle = LastTutorialsFeedRSS.description
93 
94 
95 class LastArticlesFeedRSS(LastContentFeedRSS):
96     """
97     Redefinition of `LastContentFeedRSS` for articles only
98     """
99 
100     content_type = "ARTICLE"
101     link = "/articles/"
102     title = _("Articles sur {}").format(settings.ZDS_APP["site"]["literal_name"])
103     description = _("Les derniers articles parus sur {}.").format(settings.ZDS_APP["site"]["literal_name"])
104 
105 
106 class LastArticlesFeedATOM(LastArticlesFeedRSS):
107     feed_type = Atom1Feed
108     subtitle = LastArticlesFeedRSS.description
109 
110 
111 class LastOpinionsFeedRSS(LastContentFeedRSS):
112     """
113     Redefinition of `LastContentFeedRSS` for opinions only
114     """
115 
116     content_type = "OPINION"
117     link = "/tribunes/"
118     title = _("Tribunes sur {}").format(settings.ZDS_APP["site"]["literal_name"])
119     description = _("Les derniers billets des tribunes parus sur {}.").format(settings.ZDS_APP["site"]["literal_name"])
120 
121 
122 class LastOpinionsFeedATOM(LastOpinionsFeedRSS):
123     feed_type = Atom1Feed
124     subtitle = LastOpinionsFeedRSS.description
125
```

Path: `zds/forum/feeds.py`
Content:
```
1 from django.contrib.syndication.views import Feed
2 
3 from django.utils.feedgenerator import Atom1Feed
4 from django.conf import settings
5 
6 from .models import Post, Topic
7 
8 
9 class ItemMixin:
10     def item_pubdate(self, item):
11         return item.pubdate
12 
13     def item_author_name(self, item):
14         return item.author.username
15 
16     def item_author_link(self, item):
17         return item.author.get_absolute_url()
18 
19     def item_link(self, item):
20         return item.get_absolute_url()
21 
22 
23 def request_object(request):
24     obj = {}
25     if "forum" in request.GET:
26         obj["forum"] = request.GET["forum"]
27     if "tag" in request.GET:
28         obj["tag"] = request.GET["tag"]
29     return obj
30 
31 
32 class LastPostsFeedRSS(Feed, ItemMixin):
33     title = "Derniers messages sur {}".format(settings.ZDS_APP["site"]["literal_name"])
34     link = "/forums/"
35     description = "Les derniers messages " "parus sur le forum de {}.".format(settings.ZDS_APP["site"]["literal_name"])
36 
37     def get_object(self, request):
38         return request_object(request)
39 
40     def items(self, obj):
41         try:
42             posts = Post.objects.filter(topic__forum__groups__isnull=True)
43             if "forum" in obj:
44                 posts = posts.filter(topic__forum__pk=int(obj["forum"]))
45             if "tag" in obj:
46                 posts = posts.filter(topic__tags__pk__in=[obj["tag"]])
47             posts = posts.order_by("-pubdate")[: settings.ZDS_APP["forum"]["posts_per_page"]]
48         except (Post.DoesNotExist, ValueError):
49             posts = []
50         return posts
51 
52     def item_title(self, item):
53         return f"{item.topic.title}, message #{item.pk}"
54 
55     def item_description(self, item):
56         return item.text_html
57 
58 
59 class LastPostsFeedATOM(LastPostsFeedRSS):
60     feed_type = Atom1Feed
61     subtitle = LastPostsFeedRSS.description
62 
63 
64 class LastTopicsFeedRSS(Feed, ItemMixin):
65     title = "Derniers sujets sur {}".format(settings.ZDS_APP["site"]["literal_name"])
66     link = "/forums/"
67     description = "Les derniers sujets créés sur le forum de {}.".format(settings.ZDS_APP["site"]["literal_name"])
68 
69     def get_object(self, request):
70         return request_object(request)
71 
72     def items(self, obj):
73         try:
74             topics = Topic.objects.filter(forum__groups__isnull=True)
75             if "forum" in obj:
76                 topics = topics.filter(forum__pk=int(obj["forum"]))
77             if "tag" in obj:
78                 topics = topics.filter(tags__pk__in=[obj["tag"]])
79             topics = topics.order_by("-pubdate")[: settings.ZDS_APP["forum"]["posts_per_page"]]
80         except (Topic.DoesNotExist, ValueError):
81             topics = []
82         return topics
83 
84     def item_title(self, item):
85         return f"{item.title} dans {item.forum.title}"
86 
87     def item_description(self, item):
88         return item.subtitle
89 
90 
91 class LastTopicsFeedATOM(LastTopicsFeedRSS):
92     feed_type = Atom1Feed
93     subtitle = LastTopicsFeedRSS.description
94
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/zds/forum/feeds.py b/zds/forum/feeds.py
--- a/zds/forum/feeds.py
+++ b/zds/forum/feeds.py
@@ -2,13 +2,21 @@
 
 from django.utils.feedgenerator import Atom1Feed
 from django.conf import settings
+from django.utils.timezone import make_aware
+from pytz import AmbiguousTimeError, NonExistentTimeError
 
 from .models import Post, Topic
 
 
 class ItemMixin:
     def item_pubdate(self, item):
-        return item.pubdate
+        try:
+            return make_aware(item.pubdate)
+        except AmbiguousTimeError:
+            try:
+                return make_aware(item.pubdate, is_dst=True)
+            except NonExistentTimeError:
+                return make_aware(item.pubdate, is_dst=False)
 
     def item_author_name(self, item):
         return item.author.username
diff --git a/zds/tutorialv2/feeds.py b/zds/tutorialv2/feeds.py
--- a/zds/tutorialv2/feeds.py
+++ b/zds/tutorialv2/feeds.py
@@ -1,8 +1,10 @@
 from django.conf import settings
 from django.contrib.syndication.views import Feed
 from django.shortcuts import get_object_or_404
+from django.utils.timezone import make_aware
 from django.utils.feedgenerator import Atom1Feed
 from django.utils.translation import gettext_lazy as _
+from pytz import AmbiguousTimeError, NonExistentTimeError
 
 from zds.utils.models import Category, SubCategory, Tag
 from zds.utils.uuslug_wrapper import slugify
@@ -54,7 +56,13 @@
         return item.content.title
 
     def item_pubdate(self, item):
-        return item.publication_date
+        try:
+            return make_aware(item.publication_date)
+        except AmbiguousTimeError:
+            try:
+                return make_aware(item.publication_date, is_dst=True)
+            except NonExistentTimeError:
+                return make_aware(item.publication_date, is_dst=False)
 
     def item_description(self, item):
         return item.content.description

{"golden_diff": "diff --git a/zds/forum/feeds.py b/zds/forum/feeds.py\n--- a/zds/forum/feeds.py\n+++ b/zds/forum/feeds.py\n@@ -2,13 +2,21 @@\n \n from django.utils.feedgenerator import Atom1Feed\n from django.conf import settings\n+from django.utils.timezone import make_aware\n+from pytz import AmbiguousTimeError, NonExistentTimeError\n \n from .models import Post, Topic\n \n \n class ItemMixin:\n     def item_pubdate(self, item):\n-        return item.pubdate\n+        try:\n+            return make_aware(item.pubdate)\n+        except AmbiguousTimeError:\n+            try:\n+                return make_aware(item.pubdate, is_dst=True)\n+            except NonExistentTimeError:\n+                return make_aware(item.pubdate, is_dst=False)\n \n     def item_author_name(self, item):\n         return item.author.username\ndiff --git a/zds/tutorialv2/feeds.py b/zds/tutorialv2/feeds.py\n--- a/zds/tutorialv2/feeds.py\n+++ b/zds/tutorialv2/feeds.py\n@@ -1,8 +1,10 @@\n from django.conf import settings\n from django.contrib.syndication.views import Feed\n from django.shortcuts import get_object_or_404\n+from django.utils.timezone import make_aware\n from django.utils.feedgenerator import Atom1Feed\n from django.utils.translation import gettext_lazy as _\n+from pytz import AmbiguousTimeError, NonExistentTimeError\n \n from zds.utils.models import Category, SubCategory, Tag\n from zds.utils.uuslug_wrapper import slugify\n@@ -54,7 +56,13 @@\n         return item.content.title\n \n     def item_pubdate(self, item):\n-        return item.publication_date\n+        try:\n+            return make_aware(item.publication_date)\n+        except AmbiguousTimeError:\n+            try:\n+                return make_aware(item.publication_date, is_dst=True)\n+            except NonExistentTimeError:\n+                return make_aware(item.publication_date, is_dst=False)\n \n     def item_description(self, item):\n         return item.content.description\n", "issue": "https://zestedesavoir.com/forums/flux/sujets/rss/ retourne une erreur 500\n**Description du bug**\r\n\r\nles rss des sujets ont l'air morts\r\n\r\nhttps://zestedesavoir.com/forums/flux/sujets/rss/\n", "before_files": [{"content": "from django.conf import settings\nfrom django.contrib.syndication.views import Feed\nfrom django.shortcuts import get_object_or_404\nfrom django.utils.feedgenerator import Atom1Feed\nfrom django.utils.translation import gettext_lazy as _\n\nfrom zds.utils.models import Category, SubCategory, Tag\nfrom zds.utils.uuslug_wrapper import slugify\nfrom zds.tutorialv2.models.database import PublishedContent\n\n\nclass LastContentFeedRSS(Feed):\n    \"\"\"\n    RSS feed for any type of content.\n    \"\"\"\n\n    title = _(\"Contenus sur {}\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    description = _(\"Les derniers contenus parus sur {}.\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    link = \"\"\n    content_type = None\n    query_params = {}\n\n    def get_object(self, request, *args, **kwargs):\n        self.query_params = request.GET\n        return super().get_object(request, *args, **kwargs)\n\n    def items(self):\n        \"\"\"\n        :return: The last (typically 5) contents (sorted by publication date).\n        \"\"\"\n        subcategories = None\n        category = self.query_params.get(\"category\", \"\").strip()\n        if category:\n            category = get_object_or_404(Category, slug=category)\n            subcategories = category.get_subcategories()\n        subcategory = self.query_params.get(\"subcategory\", \"\").strip()\n        if subcategory:\n            subcategories = [get_object_or_404(SubCategory, slug=subcategory)]\n\n        tags = None\n        tag = self.query_params.get(\"tag\", \"\").strip()\n        if tag:\n            tags = [get_object_or_404(Tag, slug=slugify(self.query_params.get(\"tag\")))]\n\n        feed_length = settings.ZDS_APP[\"content\"][\"feed_length\"]\n\n        contents = PublishedContent.objects.last_contents(\n            content_type=[self.content_type], subcategories=subcategories, tags=tags\n        )[:feed_length]\n\n        return contents\n\n    def item_title(self, item):\n        return item.content.title\n\n    def item_pubdate(self, item):\n        return item.publication_date\n\n    def item_description(self, item):\n        return item.content.description\n\n    def item_author_name(self, item):\n        authors_list = item.content.authors.all()\n        authors = []\n        for authors_obj in authors_list:\n            authors.append(authors_obj.username)\n        authors = \", \".join(authors)\n        return authors\n\n    def item_link(self, item):\n        return item.get_absolute_url_online()\n\n\nclass LastContentFeedATOM(LastContentFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastContentFeedRSS.description\n\n\nclass LastTutorialsFeedRSS(LastContentFeedRSS):\n    \"\"\"\n    Redefinition of `LastContentFeedRSS` for tutorials only\n    \"\"\"\n\n    content_type = \"TUTORIAL\"\n    link = \"/tutoriels/\"\n    title = _(\"Tutoriels sur {}\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    description = _(\"Les derniers tutoriels parus sur {}.\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n\n\nclass LastTutorialsFeedATOM(LastTutorialsFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastTutorialsFeedRSS.description\n\n\nclass LastArticlesFeedRSS(LastContentFeedRSS):\n    \"\"\"\n    Redefinition of `LastContentFeedRSS` for articles only\n    \"\"\"\n\n    content_type = \"ARTICLE\"\n    link = \"/articles/\"\n    title = _(\"Articles sur {}\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    description = _(\"Les derniers articles parus sur {}.\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n\n\nclass LastArticlesFeedATOM(LastArticlesFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastArticlesFeedRSS.description\n\n\nclass LastOpinionsFeedRSS(LastContentFeedRSS):\n    \"\"\"\n    Redefinition of `LastContentFeedRSS` for opinions only\n    \"\"\"\n\n    content_type = \"OPINION\"\n    link = \"/tribunes/\"\n    title = _(\"Tribunes sur {}\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    description = _(\"Les derniers billets des tribunes parus sur {}.\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n\n\nclass LastOpinionsFeedATOM(LastOpinionsFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastOpinionsFeedRSS.description\n", "path": "zds/tutorialv2/feeds.py"}, {"content": "from django.contrib.syndication.views import Feed\n\nfrom django.utils.feedgenerator import Atom1Feed\nfrom django.conf import settings\n\nfrom .models import Post, Topic\n\n\nclass ItemMixin:\n    def item_pubdate(self, item):\n        return item.pubdate\n\n    def item_author_name(self, item):\n        return item.author.username\n\n    def item_author_link(self, item):\n        return item.author.get_absolute_url()\n\n    def item_link(self, item):\n        return item.get_absolute_url()\n\n\ndef request_object(request):\n    obj = {}\n    if \"forum\" in request.GET:\n        obj[\"forum\"] = request.GET[\"forum\"]\n    if \"tag\" in request.GET:\n        obj[\"tag\"] = request.GET[\"tag\"]\n    return obj\n\n\nclass LastPostsFeedRSS(Feed, ItemMixin):\n    title = \"Derniers messages sur {}\".format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    link = \"/forums/\"\n    description = \"Les derniers messages \" \"parus sur le forum de {}.\".format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n\n    def get_object(self, request):\n        return request_object(request)\n\n    def items(self, obj):\n        try:\n            posts = Post.objects.filter(topic__forum__groups__isnull=True)\n            if \"forum\" in obj:\n                posts = posts.filter(topic__forum__pk=int(obj[\"forum\"]))\n            if \"tag\" in obj:\n                posts = posts.filter(topic__tags__pk__in=[obj[\"tag\"]])\n            posts = posts.order_by(\"-pubdate\")[: settings.ZDS_APP[\"forum\"][\"posts_per_page\"]]\n        except (Post.DoesNotExist, ValueError):\n            posts = []\n        return posts\n\n    def item_title(self, item):\n        return f\"{item.topic.title}, message #{item.pk}\"\n\n    def item_description(self, item):\n        return item.text_html\n\n\nclass LastPostsFeedATOM(LastPostsFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastPostsFeedRSS.description\n\n\nclass LastTopicsFeedRSS(Feed, ItemMixin):\n    title = \"Derniers sujets sur {}\".format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    link = \"/forums/\"\n    description = \"Les derniers sujets cr\u00e9\u00e9s sur le forum de {}.\".format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n\n    def get_object(self, request):\n        return request_object(request)\n\n    def items(self, obj):\n        try:\n            topics = Topic.objects.filter(forum__groups__isnull=True)\n            if \"forum\" in obj:\n                topics = topics.filter(forum__pk=int(obj[\"forum\"]))\n            if \"tag\" in obj:\n                topics = topics.filter(tags__pk__in=[obj[\"tag\"]])\n            topics = topics.order_by(\"-pubdate\")[: settings.ZDS_APP[\"forum\"][\"posts_per_page\"]]\n        except (Topic.DoesNotExist, ValueError):\n            topics = []\n        return topics\n\n    def item_title(self, item):\n        return f\"{item.title} dans {item.forum.title}\"\n\n    def item_description(self, item):\n        return item.subtitle\n\n\nclass LastTopicsFeedATOM(LastTopicsFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastTopicsFeedRSS.description\n", "path": "zds/forum/feeds.py"}], "after_files": [{"content": "from django.conf import settings\nfrom django.contrib.syndication.views import Feed\nfrom django.shortcuts import get_object_or_404\nfrom django.utils.timezone import make_aware\nfrom django.utils.feedgenerator import Atom1Feed\nfrom django.utils.translation import gettext_lazy as _\nfrom pytz import AmbiguousTimeError, NonExistentTimeError\n\nfrom zds.utils.models import Category, SubCategory, Tag\nfrom zds.utils.uuslug_wrapper import slugify\nfrom zds.tutorialv2.models.database import PublishedContent\n\n\nclass LastContentFeedRSS(Feed):\n    \"\"\"\n    RSS feed for any type of content.\n    \"\"\"\n\n    title = _(\"Contenus sur {}\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    description = _(\"Les derniers contenus parus sur {}.\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    link = \"\"\n    content_type = None\n    query_params = {}\n\n    def get_object(self, request, *args, **kwargs):\n        self.query_params = request.GET\n        return super().get_object(request, *args, **kwargs)\n\n    def items(self):\n        \"\"\"\n        :return: The last (typically 5) contents (sorted by publication date).\n        \"\"\"\n        subcategories = None\n        category = self.query_params.get(\"category\", \"\").strip()\n        if category:\n            category = get_object_or_404(Category, slug=category)\n            subcategories = category.get_subcategories()\n        subcategory = self.query_params.get(\"subcategory\", \"\").strip()\n        if subcategory:\n            subcategories = [get_object_or_404(SubCategory, slug=subcategory)]\n\n        tags = None\n        tag = self.query_params.get(\"tag\", \"\").strip()\n        if tag:\n            tags = [get_object_or_404(Tag, slug=slugify(self.query_params.get(\"tag\")))]\n\n        feed_length = settings.ZDS_APP[\"content\"][\"feed_length\"]\n\n        contents = PublishedContent.objects.last_contents(\n            content_type=[self.content_type], subcategories=subcategories, tags=tags\n        )[:feed_length]\n\n        return contents\n\n    def item_title(self, item):\n        return item.content.title\n\n    def item_pubdate(self, item):\n        try:\n            return make_aware(item.publication_date)\n        except AmbiguousTimeError:\n            try:\n                return make_aware(item.publication_date, is_dst=True)\n            except NonExistentTimeError:\n                return make_aware(item.publication_date, is_dst=False)\n\n    def item_description(self, item):\n        return item.content.description\n\n    def item_author_name(self, item):\n        authors_list = item.content.authors.all()\n        authors = []\n        for authors_obj in authors_list:\n            authors.append(authors_obj.username)\n        authors = \", \".join(authors)\n        return authors\n\n    def item_link(self, item):\n        return item.get_absolute_url_online()\n\n\nclass LastContentFeedATOM(LastContentFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastContentFeedRSS.description\n\n\nclass LastTutorialsFeedRSS(LastContentFeedRSS):\n    \"\"\"\n    Redefinition of `LastContentFeedRSS` for tutorials only\n    \"\"\"\n\n    content_type = \"TUTORIAL\"\n    link = \"/tutoriels/\"\n    title = _(\"Tutoriels sur {}\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    description = _(\"Les derniers tutoriels parus sur {}.\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n\n\nclass LastTutorialsFeedATOM(LastTutorialsFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastTutorialsFeedRSS.description\n\n\nclass LastArticlesFeedRSS(LastContentFeedRSS):\n    \"\"\"\n    Redefinition of `LastContentFeedRSS` for articles only\n    \"\"\"\n\n    content_type = \"ARTICLE\"\n    link = \"/articles/\"\n    title = _(\"Articles sur {}\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    description = _(\"Les derniers articles parus sur {}.\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n\n\nclass LastArticlesFeedATOM(LastArticlesFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastArticlesFeedRSS.description\n\n\nclass LastOpinionsFeedRSS(LastContentFeedRSS):\n    \"\"\"\n    Redefinition of `LastContentFeedRSS` for opinions only\n    \"\"\"\n\n    content_type = \"OPINION\"\n    link = \"/tribunes/\"\n    title = _(\"Tribunes sur {}\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    description = _(\"Les derniers billets des tribunes parus sur {}.\").format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n\n\nclass LastOpinionsFeedATOM(LastOpinionsFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastOpinionsFeedRSS.description\n", "path": "zds/tutorialv2/feeds.py"}, {"content": "from django.contrib.syndication.views import Feed\n\nfrom django.utils.feedgenerator import Atom1Feed\nfrom django.conf import settings\nfrom django.utils.timezone import make_aware\nfrom pytz import AmbiguousTimeError, NonExistentTimeError\n\nfrom .models import Post, Topic\n\n\nclass ItemMixin:\n    def item_pubdate(self, item):\n        try:\n            return make_aware(item.pubdate)\n        except AmbiguousTimeError:\n            try:\n                return make_aware(item.pubdate, is_dst=True)\n            except NonExistentTimeError:\n                return make_aware(item.pubdate, is_dst=False)\n\n    def item_author_name(self, item):\n        return item.author.username\n\n    def item_author_link(self, item):\n        return item.author.get_absolute_url()\n\n    def item_link(self, item):\n        return item.get_absolute_url()\n\n\ndef request_object(request):\n    obj = {}\n    if \"forum\" in request.GET:\n        obj[\"forum\"] = request.GET[\"forum\"]\n    if \"tag\" in request.GET:\n        obj[\"tag\"] = request.GET[\"tag\"]\n    return obj\n\n\nclass LastPostsFeedRSS(Feed, ItemMixin):\n    title = \"Derniers messages sur {}\".format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    link = \"/forums/\"\n    description = \"Les derniers messages \" \"parus sur le forum de {}.\".format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n\n    def get_object(self, request):\n        return request_object(request)\n\n    def items(self, obj):\n        try:\n            posts = Post.objects.filter(topic__forum__groups__isnull=True)\n            if \"forum\" in obj:\n                posts = posts.filter(topic__forum__pk=int(obj[\"forum\"]))\n            if \"tag\" in obj:\n                posts = posts.filter(topic__tags__pk__in=[obj[\"tag\"]])\n            posts = posts.order_by(\"-pubdate\")[: settings.ZDS_APP[\"forum\"][\"posts_per_page\"]]\n        except (Post.DoesNotExist, ValueError):\n            posts = []\n        return posts\n\n    def item_title(self, item):\n        return f\"{item.topic.title}, message #{item.pk}\"\n\n    def item_description(self, item):\n        return item.text_html\n\n\nclass LastPostsFeedATOM(LastPostsFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastPostsFeedRSS.description\n\n\nclass LastTopicsFeedRSS(Feed, ItemMixin):\n    title = \"Derniers sujets sur {}\".format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n    link = \"/forums/\"\n    description = \"Les derniers sujets cr\u00e9\u00e9s sur le forum de {}.\".format(settings.ZDS_APP[\"site\"][\"literal_name\"])\n\n    def get_object(self, request):\n        return request_object(request)\n\n    def items(self, obj):\n        try:\n            topics = Topic.objects.filter(forum__groups__isnull=True)\n            if \"forum\" in obj:\n                topics = topics.filter(forum__pk=int(obj[\"forum\"]))\n            if \"tag\" in obj:\n                topics = topics.filter(tags__pk__in=[obj[\"tag\"]])\n            topics = topics.order_by(\"-pubdate\")[: settings.ZDS_APP[\"forum\"][\"posts_per_page\"]]\n        except (Topic.DoesNotExist, ValueError):\n            topics = []\n        return topics\n\n    def item_title(self, item):\n        return f\"{item.title} dans {item.forum.title}\"\n\n    def item_description(self, item):\n        return item.subtitle\n\n\nclass LastTopicsFeedATOM(LastTopicsFeedRSS):\n    feed_type = Atom1Feed\n    subtitle = LastTopicsFeedRSS.description\n", "path": "zds/forum/feeds.py"}]}