Skip to content

Commit

Permalink
Fix an activity streams crash
Browse files Browse the repository at this point in the history
It seems that _group_activity_query() can sometimes be called for a
group that doesn't exist (though I'm not sure exactly how this happens).
A test was failing. Not sure how this crept into master.  Fix it to
handle this case.
  • Loading branch information
Sean Hammond committed Nov 28, 2012
1 parent bc17953 commit aeddf42
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ckan/model/activity.py
Expand Up @@ -150,6 +150,10 @@ def _group_activity_query(group_id, limit=15):
import ckan.model as model

group = model.Group.get(group_id)
if not group:
# Return a query with no results.
return model.Session.query(model.Activity).filter("0=1")

dataset_ids = [dataset.id for dataset in group.packages()]

q = model.Session.query(model.Activity)
Expand Down

0 comments on commit aeddf42

Please sign in to comment.