Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
frontend/afe/feeds/feed.py | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/frontend/afe/feeds/feed.py b/frontend/afe/feeds/feed.py
index 4e013b4..c260d83 100644
--- a/frontend/afe/feeds/feed.py
+++ b/frontend/afe/feeds/feed.py
@@ -3,16 +3,17 @@ from django.contrib.syndication import views
from autotest.frontend.afe import models
-# Copied from django/contrib/syndication/views.py. The default view doesn't
-# give the feed any way to access the request object, and we need to access it
-# to get the server hostname. So we're forced to copy the code here and modify
-# it to pass in the request.
-from django.http import HttpResponse, Http404
-
-# name changed from feed to feed_view
def feed_view(request, url, feed_dict=None):
+ """
+ View a feed.
+
+ Copied from django/contrib/syndication/views.py. The default view doesn't
+ give the feed any way to access the request object, and we need to access
it
+ to get the server hostname. So we're forced to copy the code here and
+ modify it to pass in the request.
+ """
if not feed_dict:
- raise Http404, "No feeds are registered."
+ raise django.http.Http404("No feeds are registered.")
try:
slug, param = url.split('/', 1)
@@ -22,22 +23,24 @@ def feed_view(request, url, feed_dict=None):
try:
f = feed_dict[slug]
except KeyError:
- raise Http404, "Slug %r isn't registered." % slug
+ raise django.http.Http404("Slug %r isn't registered." % slug)
try:
# this line is changed from the Django library version to pass
# in request instead of request.path
feedgen = f(slug, request).get_feed(param)
except views.FeedDoesNotExist:
- raise Http404, "Invalid feed parameters. Slug %r is valid, but other
parameters, or lack thereof, are not." % slug
+ raise django.http.Http404("Invalid feed parameters. Slug %r is valid, "
+ "but other parameters, or lack thereof, "
+ "are not." % slug)
- response = HttpResponse(mimetype=feedgen.mime_type)
+ response = django.http.HttpResponse(mimetype=feedgen.mime_type)
feedgen.write(response, 'utf-8')
return response
-# end copied code
+
class JobFeed(views.Feed):
- """\
+ """
Common feed functionality.
"""
link = "/results"
--
1.7.10.2
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest