prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Don't send additional 500 email if no useful information in it.
  After the implementation if #1485 we get an additional email for _all_ 500 errors, even if there is no supplied information. Let's not send an email if there's no useful information in it.
  
  
  </issue>
  <code>
  [start of onlineweb4/views.py]
  1 # -*- coding: utf-8 -*-
  2 import logging
  3 from smtplib import SMTPException
  4 
  5 from django.conf import settings
  6 from django.contrib import messages
  7 from django.core.mail import send_mail
  8 from django.shortcuts import redirect, render
  9 from onlineweb4.forms import ErrorForm
  10 
  11 
  12 def server_error(request):
  13     log = logging.getLogger(__name__)
  14 
  15     if request.method == 'POST':
  16         form = ErrorForm(request.POST)
  17         message = request.POST.get('reason', 'Ingen forklaring oppgitt.')
  18         try: 
  19             log.error('%s triggered a 500 server error and provided the following description: %s' % (
  20                 request.user,
  21                 message
  22             ))
  23             send_mail('500error user-report', message,
  24                 settings.DEFAULT_FROM_EMAIL, [settings.EMAIL_DOTKOM])
  25             log.debug('Finished sending error email to %s' % settings.EMAIL_DOTKOM)
  26 
  27             messages.success(request, 'Feilmeldingen din ble sendt til %s' % settings.EMAIL_DOTKOM)
  28 
  29             return redirect('home')
  30         except SMTPException:
  31             messages.error(request, 'Det oppstod en uventet feil under sending av feilmeldingen')
  32             return redirect('home')
  33 
  34     return render(request, '500.html', {'error_form': ErrorForm})
  35
  [end of onlineweb4/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/onlineweb4/views.py b/onlineweb4/views.py
  --- a/onlineweb4/views.py
  +++ b/onlineweb4/views.py
  @@ -1,21 +1,22 @@
   # -*- coding: utf-8 -*-
   import logging
  -from smtplib import SMTPException
   
   from django.conf import settings
   from django.contrib import messages
   from django.core.mail import send_mail
   from django.shortcuts import redirect, render
   from onlineweb4.forms import ErrorForm
  +from smtplib import SMTPException
   
   
   def server_error(request):
       log = logging.getLogger(__name__)
   
       if request.method == 'POST':
  -        form = ErrorForm(request.POST)
  -        message = request.POST.get('reason', 'Ingen forklaring oppgitt.')
  -        try: 
  +        message = request.POST.get('reason')
  +        if not message:
  +            return redirect('home')
  +        try:
               log.error('%s triggered a 500 server error and provided the following description: %s' % (
                   request.user,
                   message
  @@ -23,12 +24,9 @@
               send_mail('500error user-report', message,
                   settings.DEFAULT_FROM_EMAIL, [settings.EMAIL_DOTKOM])
               log.debug('Finished sending error email to %s' % settings.EMAIL_DOTKOM)
  -
               messages.success(request, 'Feilmeldingen din ble sendt til %s' % settings.EMAIL_DOTKOM)
  -
               return redirect('home')
           except SMTPException:
               messages.error(request, 'Det oppstod en uventet feil under sending av feilmeldingen')
               return redirect('home')
  -
       return render(request, '500.html', {'error_form': ErrorForm})
  
verification_info: {"golden_diff": "diff --git a/onlineweb4/views.py b/onlineweb4/views.py\n--- a/onlineweb4/views.py\n+++ b/onlineweb4/views.py\n@@ -1,21 +1,22 @@\n # -*- coding: utf-8 -*-\n import logging\n-from smtplib import SMTPException\n \n from django.conf import settings\n from django.contrib import messages\n from django.core.mail import send_mail\n from django.shortcuts import redirect, render\n from onlineweb4.forms import ErrorForm\n+from smtplib import SMTPException\n \n \n def server_error(request):\n     log = logging.getLogger(__name__)\n \n     if request.method == 'POST':\n-        form = ErrorForm(request.POST)\n-        message = request.POST.get('reason', 'Ingen forklaring oppgitt.')\n-        try: \n+        message = request.POST.get('reason')\n+        if not message:\n+            return redirect('home')\n+        try:\n             log.error('%s triggered a 500 server error and provided the following description: %s' % (\n                 request.user,\n                 message\n@@ -23,12 +24,9 @@\n             send_mail('500error user-report', message,\n                 settings.DEFAULT_FROM_EMAIL, [settings.EMAIL_DOTKOM])\n             log.debug('Finished sending error email to %s' % settings.EMAIL_DOTKOM)\n-\n             messages.success(request, 'Feilmeldingen din ble sendt til %s' % settings.EMAIL_DOTKOM)\n-\n             return redirect('home')\n         except SMTPException:\n             messages.error(request, 'Det oppstod en uventet feil under sending av feilmeldingen')\n             return redirect('home')\n-\n     return render(request, '500.html', {'error_form': ErrorForm})\n", "issue": "Don't send additional 500 email if no useful information in it.\nAfter the implementation if #1485 we get an additional email for _all_ 500 errors, even if there is no supplied information. Let's not send an email if there's no useful information in it.\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nimport logging\nfrom smtplib import SMTPException\n\nfrom django.conf import settings\nfrom django.contrib import messages\nfrom django.core.mail import send_mail\nfrom django.shortcuts import redirect, render\nfrom onlineweb4.forms import ErrorForm\n\n\ndef server_error(request):\n    log = logging.getLogger(__name__)\n\n    if request.method == 'POST':\n        form = ErrorForm(request.POST)\n        message = request.POST.get('reason', 'Ingen forklaring oppgitt.')\n        try: \n            log.error('%s triggered a 500 server error and provided the following description: %s' % (\n                request.user,\n                message\n            ))\n            send_mail('500error user-report', message,\n                settings.DEFAULT_FROM_EMAIL, [settings.EMAIL_DOTKOM])\n            log.debug('Finished sending error email to %s' % settings.EMAIL_DOTKOM)\n\n            messages.success(request, 'Feilmeldingen din ble sendt til %s' % settings.EMAIL_DOTKOM)\n\n            return redirect('home')\n        except SMTPException:\n            messages.error(request, 'Det oppstod en uventet feil under sending av feilmeldingen')\n            return redirect('home')\n\n    return render(request, '500.html', {'error_form': ErrorForm})\n", "path": "onlineweb4/views.py"}]}