From: Michael Halstead <[email protected]>

---
 Post/views.py | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/Post/views.py b/Post/views.py
index 5737076..0ad58ba 100644
--- a/Post/views.py
+++ b/Post/views.py
@@ -256,23 +256,23 @@ def search(request, mode=results_mode.LATEST, **kwargs):
         items = items.order_by()
         return render(request, "latest-errors.html", context)
 
-
 def details(request, fail_id):
     try:
         build_failure = BuildFailure.objects.get(id=fail_id)
     except ObjectDoesNotExist:
         build_failure = None
-    try:
-        referer = urlparse(request.META['HTTP_REFERER'])
-        referer_hostname = referer.hostname
-        if referer.port:
-            referer_hostname += ":" + str(referer.port)
-        if referer_hostname != request.get_host():
-            build_failure.REFERER = 'OTHER'
-    except KeyError:
-        # There is no referer
-        build_failure.REFERER = 'NO_REFERER'
-    build_failure.save()
+    if build_failure:
+        try:
+            referer = urlparse(request.META['HTTP_REFERER'])
+            referer_hostname = referer.hostname
+            if referer.port:
+                referer_hostname += ":" + str(referer.port)
+            if referer_hostname != request.get_host():
+                build_failure.REFERER = 'OTHER'
+        except KeyError:
+            # There is no referer
+            build_failure.REFERER = 'NO_REFERER'
+        build_failure.save()
 
     context = {'detail' : build_failure, 'error_types' : ErrorType }
 
-- 
2.11.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#52909): https://lists.yoctoproject.org/g/yocto/message/52909
Mute This Topic: https://lists.yoctoproject.org/mt/81616918/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to