prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  RSS/Atom Feed: Don't show Changes headline if Changelog is empty
  Needs a check if item.changelog is empty https://github.com/nextcloud/appstore/blob/master/nextcloudappstore/core/feeds.py#L36
  
  </issue>
  <code>
  [start of nextcloudappstore/core/feeds.py]
  1 from django.conf import settings
  2 from django.contrib.syndication.views import Feed
  3 from django.urls import reverse
  4 from django.urls import reverse_lazy
  5 from django.utils.feedgenerator import Atom1Feed
  6 from django.utils.translation import ugettext_lazy as _  # type: ignore
  7 from parler.models import TranslationDoesNotExist
  8 
  9 from nextcloudappstore.core.models import AppRelease
  10 from markdown import markdown
  11 from bleach import clean
  12 
  13 
  14 class AppReleaseRssFeed(Feed):
  15     title = _('Newest app releases')
  16     description = _('Get the newest app release updates')
  17     link = reverse_lazy('home')
  18 
  19     def __call__(self, request, *args, **kwargs):
  20         self.request = request
  21         return super().__call__(request, *args, **kwargs)
  22 
  23     def items(self):
  24         queryset = AppRelease.objects.order_by('-last_modified')
  25         if 'nightly' not in self.request.GET:
  26             queryset = queryset.filter(is_nightly=False)
  27         if 'prerelease' not in self.request.GET:
  28             queryset = queryset.exclude(version__contains='-')
  29         return queryset[:10]
  30 
  31     def item_title(self, item):
  32         return '%s (%s)' % (item.app.name, item.version)
  33 
  34     def item_description(self, item):
  35         try:
  36             content = ('%s\n\n# %s\n\n%s' % (
  37                 item.app.description, _('Changes'), item.changelog))
  38         except TranslationDoesNotExist:
  39             content = item.app.description
  40         content += '\n\n [%s](%s)' % (_('Download'), item.download)
  41         return clean(markdown(content),
  42                      attributes=settings.MARKDOWN_ALLOWED_ATTRIBUTES,
  43                      tags=settings.MARKDOWN_ALLOWED_TAGS)
  44 
  45     def item_guid(self, obj):
  46         if obj.is_nightly:
  47             nightly = '-nightly'
  48         else:
  49             nightly = ''
  50         return '%s-%s%s' % (obj.app.id, obj.version, nightly)
  51 
  52     def item_link(self, item):
  53         return reverse('app-detail', kwargs={'id': item.app.id})
  54 
  55     def item_author_name(self, item):
  56         return '%s %s' % (item.app.owner.first_name, item.app.owner.last_name)
  57 
  58     def item_pubdate(self, item):
  59         return item.last_modified
  60 
  61     def item_updateddate(self, item):
  62         return item.last_modified
  63 
  64 
  65 class AppReleaseAtomFeed(AppReleaseRssFeed):
  66     feed_type = Atom1Feed
  67     subtitle = AppReleaseRssFeed.description
  68
  [end of nextcloudappstore/core/feeds.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/nextcloudappstore/core/feeds.py b/nextcloudappstore/core/feeds.py
  --- a/nextcloudappstore/core/feeds.py
  +++ b/nextcloudappstore/core/feeds.py
  @@ -33,8 +33,11 @@
   
       def item_description(self, item):
           try:
  -            content = ('%s\n\n# %s\n\n%s' % (
  -                item.app.description, _('Changes'), item.changelog))
  +            if item.changelog:
  +                changelog = '\n\n# %s\n\n%s' % (_('Changes'), item.changelog)
  +            else:
  +                changelog = ''
  +            content = '%s%s' % (item.app.description, changelog)
           except TranslationDoesNotExist:
               content = item.app.description
           content += '\n\n [%s](%s)' % (_('Download'), item.download)
  
verification_info: {"golden_diff": "diff --git a/nextcloudappstore/core/feeds.py b/nextcloudappstore/core/feeds.py\n--- a/nextcloudappstore/core/feeds.py\n+++ b/nextcloudappstore/core/feeds.py\n@@ -33,8 +33,11 @@\n \n     def item_description(self, item):\n         try:\n-            content = ('%s\\n\\n# %s\\n\\n%s' % (\n-                item.app.description, _('Changes'), item.changelog))\n+            if item.changelog:\n+                changelog = '\\n\\n# %s\\n\\n%s' % (_('Changes'), item.changelog)\n+            else:\n+                changelog = ''\n+            content = '%s%s' % (item.app.description, changelog)\n         except TranslationDoesNotExist:\n             content = item.app.description\n         content += '\\n\\n [%s](%s)' % (_('Download'), item.download)\n", "issue": "RSS/Atom Feed: Don't show Changes headline if Changelog is empty\nNeeds a check if item.changelog is empty https://github.com/nextcloud/appstore/blob/master/nextcloudappstore/core/feeds.py#L36\n", "before_files": [{"content": "from django.conf import settings\nfrom django.contrib.syndication.views import Feed\nfrom django.urls import reverse\nfrom django.urls import reverse_lazy\nfrom django.utils.feedgenerator import Atom1Feed\nfrom django.utils.translation import ugettext_lazy as _  # type: ignore\nfrom parler.models import TranslationDoesNotExist\n\nfrom nextcloudappstore.core.models import AppRelease\nfrom markdown import markdown\nfrom bleach import clean\n\n\nclass AppReleaseRssFeed(Feed):\n    title = _('Newest app releases')\n    description = _('Get the newest app release updates')\n    link = reverse_lazy('home')\n\n    def __call__(self, request, *args, **kwargs):\n        self.request = request\n        return super().__call__(request, *args, **kwargs)\n\n    def items(self):\n        queryset = AppRelease.objects.order_by('-last_modified')\n        if 'nightly' not in self.request.GET:\n            queryset = queryset.filter(is_nightly=False)\n        if 'prerelease' not in self.request.GET:\n            queryset = queryset.exclude(version__contains='-')\n        return queryset[:10]\n\n    def item_title(self, item):\n        return '%s (%s)' % (item.app.name, item.version)\n\n    def item_description(self, item):\n        try:\n            content = ('%s\\n\\n# %s\\n\\n%s' % (\n                item.app.description, _('Changes'), item.changelog))\n        except TranslationDoesNotExist:\n            content = item.app.description\n        content += '\\n\\n [%s](%s)' % (_('Download'), item.download)\n        return clean(markdown(content),\n                     attributes=settings.MARKDOWN_ALLOWED_ATTRIBUTES,\n                     tags=settings.MARKDOWN_ALLOWED_TAGS)\n\n    def item_guid(self, obj):\n        if obj.is_nightly:\n            nightly = '-nightly'\n        else:\n            nightly = ''\n        return '%s-%s%s' % (obj.app.id, obj.version, nightly)\n\n    def item_link(self, item):\n        return reverse('app-detail', kwargs={'id': item.app.id})\n\n    def item_author_name(self, item):\n        return '%s %s' % (item.app.owner.first_name, item.app.owner.last_name)\n\n    def item_pubdate(self, item):\n        return item.last_modified\n\n    def item_updateddate(self, item):\n        return item.last_modified\n\n\nclass AppReleaseAtomFeed(AppReleaseRssFeed):\n    feed_type = Atom1Feed\n    subtitle = AppReleaseRssFeed.description\n", "path": "nextcloudappstore/core/feeds.py"}]}