def output_feed(self, results, feed_title, feed_description, feed_link, feed_url, navigation_urls, feed_guid): author_name = config.get('ckan.feeds.author_name', '').strip() or \ config.get('ckan.site_id', '').strip() author_link = config.get('ckan.feeds.author_link', '').strip() or \ config.get('ckan.site_url', '').strip() feed = _FixedAtom1Feed( title=feed_title, link=feed_link, description=feed_description, language=u'en', author_name=author_name, author_link=author_link, feed_guid=feed_guid, feed_url=feed_url, previous_page=navigation_urls['previous'], next_page=navigation_urls['next'], first_page=navigation_urls['first'], last_page=navigation_urls['last'], ) for pkg in results: feed.add_item( title=h.get_translated(pkg, 'title'), link=h.url_for(controller='package', action='read', id=pkg['id']), description=h.get_translated(pkg, 'notes'), updated=date_str_to_datetime(pkg.get('metadata_modified')), published=date_str_to_datetime(pkg.get('metadata_created')), unique_id=_create_atom_id(u'/dataset/%s' % pkg['id']), author_name=pkg.get('author', ''), author_email=pkg.get('author_email', ''), categories=''.join(e['value'] for e in pkg.get('extras', []) if e['key'] == lx('keywords')).split(','), enclosure=webhelpers.feedgenerator.Enclosure( self.base_url + url(str('/api/action/package_show?id=%s' % pkg['name'])), unicode(len(json.dumps(pkg))), # TODO fix this u'application/json')) response.content_type = feed.mime_type return feed.writeString('utf-8')
def output_feed(self, results, feed_title, feed_description, feed_link, feed_url, navigation_urls, feed_guid): author_name = config.get('ckan.feeds.author_name', '').strip() or \ config.get('ckan.site_id', '').strip() author_link = config.get('ckan.feeds.author_link', '').strip() or \ config.get('ckan.site_url', '').strip() feed = _FixedAtom1Feed( title=feed_title, link=feed_link, description=feed_description, language=u'en', author_name=author_name, author_link=author_link, feed_guid=feed_guid, feed_url=feed_url, previous_page=navigation_urls['previous'], next_page=navigation_urls['next'], first_page=navigation_urls['first'], last_page=navigation_urls['last'], ) for pkg in results: feed.add_item( title= h.get_translated(pkg, 'title'), link=h.url_for(controller='package', action='read', id=pkg['id']), description= h.get_translated(pkg, 'notes'), updated=date_str_to_datetime(pkg.get('metadata_modified')), published=date_str_to_datetime(pkg.get('metadata_created')), unique_id=_create_atom_id(u'/dataset/%s' % pkg['id']), author_name=pkg.get('author', ''), author_email=pkg.get('author_email', ''), categories=''.join(e['value'] for e in pkg.get('extras', []) if e['key'] == lx('keywords')).split(','), enclosure=webhelpers.feedgenerator.Enclosure( self.base_url + url(str( '/api/action/package_show?id=%s' % pkg['name'])), unicode(len(json.dumps(pkg))), # TODO fix this u'application/json') ) response.content_type = feed.mime_type return feed.writeString('utf-8')