prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Unnecessary SQL select for react home landing page
  The React landing page view extracts the default filters. Every time but it's never used. 
  <img width="1502" alt="Screen Shot 2019-08-13 at 2 44 39 PM" src="https://user-images.githubusercontent.com/26739/62968514-34a08a00-bdd9-11e9-92fb-c584683c7085.png">
  
  
  </issue>
  <code>
  [start of kuma/landing/views.py]
  1 from __future__ import unicode_literals
  2 
  3 from django.conf import settings
  4 from django.http import HttpResponse
  5 from django.shortcuts import redirect, render
  6 from django.views import static
  7 from django.views.decorators.cache import never_cache
  8 from django.views.generic import RedirectView
  9 
  10 from kuma.core.decorators import ensure_wiki_domain, shared_cache_control
  11 from kuma.core.utils import is_wiki
  12 from kuma.feeder.models import Bundle
  13 from kuma.feeder.sections import SECTION_HACKS
  14 from kuma.search.models import Filter
  15 
  16 from .utils import favicon_url
  17 
  18 
  19 @shared_cache_control
  20 def contribute_json(request):
  21     return static.serve(request, 'contribute.json', document_root=settings.ROOT)
  22 
  23 
  24 @shared_cache_control
  25 def home(request):
  26     """Home page."""
  27     if is_wiki(request):
  28         return render_home(request, 'landing/homepage.html')
  29     return render_home(request, 'landing/react_homepage.html')
  30 
  31 
  32 def render_home(request, template_name):
  33     """Render the home page with the template named "template_name"."""
  34     updates = list(Bundle.objects.recent_entries(SECTION_HACKS.updates)[:5])
  35     default_filters = Filter.objects.default_filters()
  36     context = {
  37         'updates': updates,
  38         'default_filters': default_filters,
  39     }
  40     return render(request, template_name, context)
  41 
  42 
  43 @ensure_wiki_domain
  44 @never_cache
  45 def maintenance_mode(request):
  46     if settings.MAINTENANCE_MODE:
  47         return render(request, 'landing/maintenance-mode.html')
  48     else:
  49         return redirect('home')
  50 
  51 
  52 @ensure_wiki_domain
  53 @shared_cache_control
  54 def promote_buttons(request):
  55     """Bug 646192: MDN affiliate buttons"""
  56     return render(request, 'landing/promote_buttons.html')
  57 
  58 
  59 ROBOTS_ALLOWED_TXT = '''\
  60 User-agent: *
  61 Sitemap: https://developer.mozilla.org/sitemap.xml
  62 
  63 Disallow: /admin/
  64 Disallow: /api/
  65 Disallow: /*/dashboards/*
  66 Disallow: /*docs/feeds
  67 Disallow: /*docs/templates
  68 Disallow: /*docs*Template:
  69 Disallow: /*docs/all
  70 Disallow: /*docs/tag*
  71 Disallow: /*docs/needs-review*
  72 Disallow: /*docs/localization-tag*
  73 Disallow: /*docs/with-errors
  74 Disallow: /*docs/without-parent
  75 Disallow: /*docs/top-level
  76 Disallow: /*docs/new
  77 Disallow: /*docs/get-documents
  78 Disallow: /*docs/submit_akismet_spam
  79 Disallow: /*docs/load*
  80 Disallow: /*docs/Experiment:*
  81 Disallow: /*$api
  82 Disallow: /*$compare
  83 Disallow: /*$revision
  84 Disallow: /*$history
  85 Disallow: /*$children
  86 Disallow: /*$flag
  87 Disallow: /*$locales
  88 Disallow: /*$toc
  89 Disallow: /*$move
  90 Disallow: /*$quick-review
  91 Disallow: /*$samples
  92 Disallow: /*$revert
  93 Disallow: /*$repair_breadcrumbs
  94 Disallow: /*$delete
  95 Disallow: /*$restore
  96 Disallow: /*$purge
  97 Disallow: /*$subscribe
  98 Disallow: /*$subscribe_to_tree
  99 Disallow: /*$vote
  100 Disallow: /*docs.json
  101 Disallow: /*docs/ckeditor_config.js
  102 Disallow: /*/files/
  103 Disallow: /media
  104 Disallow: /*move-requested
  105 Disallow: /*preview-wiki-content
  106 Disallow: /*profiles*/edit
  107 Disallow: /skins
  108 Disallow: /*type=feed
  109 Disallow: /*users/
  110 ''' + '\n'.join('Disallow: /{locale}/search'.format(locale=locale)
  111                 for locale in settings.ENABLED_LOCALES)
  112 
  113 ROBOTS_GO_AWAY_TXT = '''\
  114 User-Agent: *
  115 Disallow: /
  116 '''
  117 
  118 
  119 @shared_cache_control
  120 def robots_txt(request):
  121     """Serve robots.txt that allows or forbids robots."""
  122     host = request.get_host()
  123     if host in settings.ALLOW_ROBOTS_DOMAINS:
  124         robots = ""
  125     elif host in settings.ALLOW_ROBOTS_WEB_DOMAINS:
  126         robots = ROBOTS_ALLOWED_TXT
  127     else:
  128         robots = ROBOTS_GO_AWAY_TXT
  129     return HttpResponse(robots, content_type='text/plain')
  130 
  131 
  132 class FaviconRedirect(RedirectView):
  133     """Redirect to the favicon in the static img folder (bug 1402497)"""
  134 
  135     def get_redirect_url(self, *args, **kwargs):
  136         return favicon_url()
  137
  [end of kuma/landing/views.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/kuma/landing/views.py b/kuma/landing/views.py
  --- a/kuma/landing/views.py
  +++ b/kuma/landing/views.py
  @@ -24,19 +24,16 @@
   @shared_cache_control
   def home(request):
       """Home page."""
  +    context = {}
  +    # Need for both wiki and react homepage
  +    context['updates'] = list(
  +        Bundle.objects.recent_entries(SECTION_HACKS.updates)[:5])
  +
  +    # The default template name
  +    template_name = 'landing/react_homepage.html'
       if is_wiki(request):
  -        return render_home(request, 'landing/homepage.html')
  -    return render_home(request, 'landing/react_homepage.html')
  -
  -
  -def render_home(request, template_name):
  -    """Render the home page with the template named "template_name"."""
  -    updates = list(Bundle.objects.recent_entries(SECTION_HACKS.updates)[:5])
  -    default_filters = Filter.objects.default_filters()
  -    context = {
  -        'updates': updates,
  -        'default_filters': default_filters,
  -    }
  +        template_name = 'landing/homepage.html'
  +        context['default_filters'] = Filter.objects.default_filters()
       return render(request, template_name, context)
  
verification_info: {"golden_diff": "diff --git a/kuma/landing/views.py b/kuma/landing/views.py\n--- a/kuma/landing/views.py\n+++ b/kuma/landing/views.py\n@@ -24,19 +24,16 @@\n @shared_cache_control\n def home(request):\n     \"\"\"Home page.\"\"\"\n+    context = {}\n+    # Need for both wiki and react homepage\n+    context['updates'] = list(\n+        Bundle.objects.recent_entries(SECTION_HACKS.updates)[:5])\n+\n+    # The default template name\n+    template_name = 'landing/react_homepage.html'\n     if is_wiki(request):\n-        return render_home(request, 'landing/homepage.html')\n-    return render_home(request, 'landing/react_homepage.html')\n-\n-\n-def render_home(request, template_name):\n-    \"\"\"Render the home page with the template named \"template_name\".\"\"\"\n-    updates = list(Bundle.objects.recent_entries(SECTION_HACKS.updates)[:5])\n-    default_filters = Filter.objects.default_filters()\n-    context = {\n-        'updates': updates,\n-        'default_filters': default_filters,\n-    }\n+        template_name = 'landing/homepage.html'\n+        context['default_filters'] = Filter.objects.default_filters()\n     return render(request, template_name, context)\n", "issue": "Unnecessary SQL select for react home landing page\nThe React landing page view extracts the default filters. Every time but it's never used. \r\n<img width=\"1502\" alt=\"Screen Shot 2019-08-13 at 2 44 39 PM\" src=\"https://user-images.githubusercontent.com/26739/62968514-34a08a00-bdd9-11e9-92fb-c584683c7085.png\">\r\n\n", "before_files": [{"content": "from __future__ import unicode_literals\n\nfrom django.conf import settings\nfrom django.http import HttpResponse\nfrom django.shortcuts import redirect, render\nfrom django.views import static\nfrom django.views.decorators.cache import never_cache\nfrom django.views.generic import RedirectView\n\nfrom kuma.core.decorators import ensure_wiki_domain, shared_cache_control\nfrom kuma.core.utils import is_wiki\nfrom kuma.feeder.models import Bundle\nfrom kuma.feeder.sections import SECTION_HACKS\nfrom kuma.search.models import Filter\n\nfrom .utils import favicon_url\n\n\n@shared_cache_control\ndef contribute_json(request):\n    return static.serve(request, 'contribute.json', document_root=settings.ROOT)\n\n\n@shared_cache_control\ndef home(request):\n    \"\"\"Home page.\"\"\"\n    if is_wiki(request):\n        return render_home(request, 'landing/homepage.html')\n    return render_home(request, 'landing/react_homepage.html')\n\n\ndef render_home(request, template_name):\n    \"\"\"Render the home page with the template named \"template_name\".\"\"\"\n    updates = list(Bundle.objects.recent_entries(SECTION_HACKS.updates)[:5])\n    default_filters = Filter.objects.default_filters()\n    context = {\n        'updates': updates,\n        'default_filters': default_filters,\n    }\n    return render(request, template_name, context)\n\n\n@ensure_wiki_domain\n@never_cache\ndef maintenance_mode(request):\n    if settings.MAINTENANCE_MODE:\n        return render(request, 'landing/maintenance-mode.html')\n    else:\n        return redirect('home')\n\n\n@ensure_wiki_domain\n@shared_cache_control\ndef promote_buttons(request):\n    \"\"\"Bug 646192: MDN affiliate buttons\"\"\"\n    return render(request, 'landing/promote_buttons.html')\n\n\nROBOTS_ALLOWED_TXT = '''\\\nUser-agent: *\nSitemap: https://developer.mozilla.org/sitemap.xml\n\nDisallow: /admin/\nDisallow: /api/\nDisallow: /*/dashboards/*\nDisallow: /*docs/feeds\nDisallow: /*docs/templates\nDisallow: /*docs*Template:\nDisallow: /*docs/all\nDisallow: /*docs/tag*\nDisallow: /*docs/needs-review*\nDisallow: /*docs/localization-tag*\nDisallow: /*docs/with-errors\nDisallow: /*docs/without-parent\nDisallow: /*docs/top-level\nDisallow: /*docs/new\nDisallow: /*docs/get-documents\nDisallow: /*docs/submit_akismet_spam\nDisallow: /*docs/load*\nDisallow: /*docs/Experiment:*\nDisallow: /*$api\nDisallow: /*$compare\nDisallow: /*$revision\nDisallow: /*$history\nDisallow: /*$children\nDisallow: /*$flag\nDisallow: /*$locales\nDisallow: /*$toc\nDisallow: /*$move\nDisallow: /*$quick-review\nDisallow: /*$samples\nDisallow: /*$revert\nDisallow: /*$repair_breadcrumbs\nDisallow: /*$delete\nDisallow: /*$restore\nDisallow: /*$purge\nDisallow: /*$subscribe\nDisallow: /*$subscribe_to_tree\nDisallow: /*$vote\nDisallow: /*docs.json\nDisallow: /*docs/ckeditor_config.js\nDisallow: /*/files/\nDisallow: /media\nDisallow: /*move-requested\nDisallow: /*preview-wiki-content\nDisallow: /*profiles*/edit\nDisallow: /skins\nDisallow: /*type=feed\nDisallow: /*users/\n''' + '\\n'.join('Disallow: /{locale}/search'.format(locale=locale)\n                for locale in settings.ENABLED_LOCALES)\n\nROBOTS_GO_AWAY_TXT = '''\\\nUser-Agent: *\nDisallow: /\n'''\n\n\n@shared_cache_control\ndef robots_txt(request):\n    \"\"\"Serve robots.txt that allows or forbids robots.\"\"\"\n    host = request.get_host()\n    if host in settings.ALLOW_ROBOTS_DOMAINS:\n        robots = \"\"\n    elif host in settings.ALLOW_ROBOTS_WEB_DOMAINS:\n        robots = ROBOTS_ALLOWED_TXT\n    else:\n        robots = ROBOTS_GO_AWAY_TXT\n    return HttpResponse(robots, content_type='text/plain')\n\n\nclass FaviconRedirect(RedirectView):\n    \"\"\"Redirect to the favicon in the static img folder (bug 1402497)\"\"\"\n\n    def get_redirect_url(self, *args, **kwargs):\n        return favicon_url()\n", "path": "kuma/landing/views.py"}]}