Skip to content
Snippets Groups Projects
Commit 51fc637b authored by Branson Craig Stephens's avatar Branson Craig Stephens
Browse files

'Fixed' feeds in order not to refer to analysisType. Instead of atype, feeds...

'Fixed' feeds in order not to refer to analysisType. Instead of atype, feeds allows you to specify a pipeline. But not a search.
parent 087d4d41
No related branches found
No related tags found
No related merge requests found
from django.contrib.syndication.views import FeedDoesNotExist from django.contrib.syndication.views import FeedDoesNotExist
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.syndication.views import Feed from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.template import RequestContext from django.template import RequestContext
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from models import Event, Group from models import Event, Group, Pipeline
from views import view, search, index #from views import view, search, index
from views import view
from django.conf import settings from django.conf import settings
FEED_MAX_RESULTS = getattr(settings, 'FEED_MAX_RESULTS', 20) FEED_MAX_RESULTS = getattr(settings, 'FEED_MAX_RESULTS', 20)
...@@ -19,7 +19,7 @@ class EventFeed(Feed): ...@@ -19,7 +19,7 @@ class EventFeed(Feed):
def get_object(self, request, url): def get_object(self, request, url):
bits = url.split('/')[1:] bits = url.split('/')[1:]
# bits will look like # bits will look like
# [] , ['cbc'], ['cbc','lowmass'] # [] , ['cbc'], ['cbc','gstlal']
objs = Event.objects.order_by("-id") objs = Event.objects.order_by("-id")
if 'test' not in bits: if 'test' not in bits:
...@@ -30,7 +30,7 @@ class EventFeed(Feed): ...@@ -30,7 +30,7 @@ class EventFeed(Feed):
if len(bits) not in [0,1,2]: if len(bits) not in [0,1,2]:
raise FeedDoesNotExist raise FeedDoesNotExist
if not bits: if not bits:
title = "GraCEDb Events" title = "GraceDB Events"
else: else:
group = Group.objects.filter(name__iexact=bits[0]) group = Group.objects.filter(name__iexact=bits[0])
if not group.count(): if not group.count():
...@@ -38,16 +38,14 @@ class EventFeed(Feed): ...@@ -38,16 +38,14 @@ class EventFeed(Feed):
group = group[0] group = group[0]
objs = Event.objects.filter(group=group) objs = Event.objects.filter(group=group)
if len(bits) == 1: if len(bits) == 1:
title = "GraCEDb %s Events" % group.name title = "GraceDB %s Events" % group.name
else: else:
requestedtype = bits[1] pipeline = Pipeline.objects.filter(name__iexact=bits[1])
type = [(c,t) for (c,t) in Event.ANALYSIS_TYPE_CHOICES \ if not pipeline.count(0):
if t.lower() == requestedtype]
if not type:
raise FeedDoesNotExist raise FeedDoesNotExist
typecode, type = type[0] pipeline = pipeline[0]
title = "GraCEDb %s / %s Events" % (group.name, type) objs = Event.objects.filter(pipeline=pipeline)
objs = objs.filter(analysisType=typecode) title = "GraceDB %s / %s Events" % (group.name, pipeline.name)
return title, objs[:FEED_MAX_RESULTS] return title, objs[:FEED_MAX_RESULTS]
def title(self, obj): def title(self, obj):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment