diff --git a/ckan/config/routing.py b/ckan/config/routing.py
index 345ff070724..70045222eb9 100644
--- a/ckan/config/routing.py
+++ b/ckan/config/routing.py
@@ -392,6 +392,7 @@ def make_map():
# feeds
with SubMapper(map, controller='feed') as m:
m.connect('/feeds/group/{id}.atom', action='group')
+ m.connect('/feeds/organization/{id}.atom', action='organization')
m.connect('/feeds/tag/{id}.atom', action='tag')
m.connect('/feeds/dataset.atom', action='general')
m.connect('/feeds/custom.atom', action='custom')
diff --git a/ckan/controllers/feed.py b/ckan/controllers/feed.py
index 3ba8b050947..29fdade323c 100644
--- a/ckan/controllers/feed.py
+++ b/ckan/controllers/feed.py
@@ -166,16 +166,12 @@ def _alternate_url(self, params, **kwargs):
controller='package',
action='search')
- def group(self, id):
- try:
- context = {'model': model, 'session': model.Session,
- 'user': c.user or c.author, 'auth_user_obj': c.userobj}
- group_dict = logic.get_action('group_show')(context, {'id': id})
- except logic.NotFound:
- base.abort(404, _('Group not found'))
+ def _group_or_organization(self, obj_dict, is_org):
data_dict, params = self._parse_url_params()
- data_dict['fq'] = 'groups:"%s"' % id
+ key = 'owner_org' if is_org else 'groups'
+ data_dict['fq'] = '%s:"%s"' % (key, obj_dict['id'],)
+ group_type = 'organization' if is_org else 'group'
item_count, results = _package_search(data_dict)
@@ -183,28 +179,60 @@ def group(self, id):
item_count=item_count,
limit=data_dict['rows'],
controller='feed',
- action='group',
- id=id)
-
+ action=group_type,
+ id=obj_dict['name'])
feed_url = self._feed_url(params,
controller='feed',
- action='group',
- id=id)
-
- alternate_url = self._alternate_url(params, groups=id)
+ action=group_type,
+ id=obj_dict['name'])
+
+ guid = _create_atom_id(u'/feeds/group/%s.atom' %
+ obj_dict['name'])
+ alternate_url = self._alternate_url(params, groups=obj_dict['name'])
+ desc = u'Recently created or updated datasets on %s by group: "%s"' %\
+ (g.site_title, obj_dict['title'])
+ title = u'%s - Group: "%s"' %\
+ (g.site_title, obj_dict['title'])
+
+ if is_org:
+ guid = _create_atom_id(u'/feeds/organization/%s.atom' %
+ obj_dict['name'])
+ alternate_url = self._alternate_url(params,
+ organization=obj_dict['name'])
+ desc = u'Recently created or updated datasets on %s '\
+ 'by organization: "%s"' % (g.site_title, obj_dict['title'])
+ title = u'%s - Organization: "%s"' %\
+ (g.site_title, obj_dict['title'])
return self.output_feed(results,
- feed_title=u'%s - Group: "%s"' %
- (g.site_title, group_dict['title']),
- feed_description=u'Recently created or '
- 'updated datasets on %s by group: "%s"' %
- (g.site_title, group_dict['title']),
+ feed_title=title,
+ feed_description=desc,
feed_link=alternate_url,
- feed_guid=_create_atom_id
- (u'/feeds/groups/%s.atom' % id),
+ feed_guid=guid,
feed_url=feed_url,
navigation_urls=navigation_urls)
+ def group(self, id):
+ try:
+ context = {'model': model, 'session': model.Session,
+ 'user': c.user or c.author, 'auth_user_obj': c.userobj}
+ group_dict = logic.get_action('group_show')(context, {'id': id})
+ except logic.NotFound:
+ base.abort(404, _('Group not found'))
+
+ return self._group_or_organization(group_dict, is_org=False)
+
+ def organization(self, id):
+ try:
+ context = {'model': model, 'session': model.Session,
+ 'user': c.user or c.author, 'auth_user_obj': c.userobj}
+ group_dict = logic.get_action('organization_show')(context,
+ {'id': id})
+ except logic.NotFound:
+ base.abort(404, _('Organization not found'))
+
+ return self._group_or_organization(group_dict, is_org=True)
+
def tag(self, id):
data_dict, params = self._parse_url_params()
data_dict['fq'] = 'tags:"%s"' % id
diff --git a/ckan/templates/organization/snippets/feeds.html b/ckan/templates/organization/snippets/feeds.html
index fb7c48c26c1..8fdffd00bb7 100644
--- a/ckan/templates/organization/snippets/feeds.html
+++ b/ckan/templates/organization/snippets/feeds.html
@@ -1,4 +1,4 @@
-{%- set dataset_feed = h.url(controller='feed', action='group', id=c.group_dict.name) -%}
+{%- set dataset_feed = h.url(controller='feed', action='organization', id=c.group_dict.name) -%}
{%- set history_feed = h.url(controller='revision', action='list', format='atom', days=1) -%}
-
+