Skip to content

Commit

Permalink
[#1593] Added tag action
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Murray committed Mar 28, 2012
1 parent 8e163d4 commit 97f2d8e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions ckan/config/routing.py
Expand Up @@ -258,6 +258,7 @@ def make_map():
# feeds
with SubMapper(map, controller='feed') as m:
m.connect('/feeds/group/{id}.atom', action='group')
m.connect('/feeds/tag/{id}.atom', action='tag')

map.connect('ckanadmin_index', '/ckan-admin', controller='admin', action='index')
map.connect('ckanadmin', '/ckan-admin/{action}', controller='admin')
Expand Down
16 changes: 15 additions & 1 deletion ckan/controllers/feed.py
Expand Up @@ -166,13 +166,27 @@ def group(self,id):

# TODO feed_link can be generated?
return self.output_feed(results,
feed_title = u'%s - %s' % (g.site_title, group_dict['title']),
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_link = u'%s/dataset?groups=%s' % (self.base_url,id),
feed_guid = _create_atom_id(u'/feeds/groups/%s.atom' % id),
)

def tag(self,id):

data_dict = {'q': 'tags: %s' % id }
results= _package_search(data_dict)

# TODO feed_link can be generated?
return self.output_feed(results,
feed_title = u'%s - Tag: "%s"' % (g.site_title, id),
feed_description = u'Recently created or updated datasets on %s by tag: "%s"' % \
(g.site_title, id),
feed_link = u'%s/dataset?tags=%s' % (self.base_url,id),
feed_guid = _create_atom_id(u'/feeds/tags/%s.atom' % id),
)

def general(self):
data_dict = {'q': '*:*' }
results= _package_search(data_dict)
Expand Down

0 comments on commit 97f2d8e

Please sign in to comment.