[ckan-changes] commit/ckanextiati: 3 new changesets
Bitbucket
commits-noreply at bitbucket.org
Thu Sep 1 13:01:54 UTC 2011
3 new changesets in ckanextiati:
http://bitbucket.org/okfn/ckanextiati/changeset/3da229b3262a/
changeset: 3da229b3262a
branch: feeds
user: amercader
date: 2011-07-15 12:44:38
summary: First draft of the RSS feeds
affected #: 3 files (2.3 KB)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ckanext/iati/feeds.py Fri Jul 15 11:44:38 2011 +0100
@@ -0,0 +1,65 @@
+from pylons.i18n import _,get_lang
+from ckan.model import Session,Package
+from ckan.lib.helpers import url_for
+from ckan.lib.base import BaseController, c, g, request, \
+ response, session, render, config, abort, redirect
+
+from webhelpers.feedgenerator import Atom1Feed,Rss201rev2Feed
+
+import logging
+log = logging.getLogger(__name__)
+
+
+"""
+TODO:
+* Order by date
+* Get updated (revisions)
+* Link to package page
+* Link to file
+"""
+
+
+class FeedsController(BaseController):
+
+ def all(self):
+ #records = Session.query(Package).order_by(Package.metadata_modified)
+ records = Session.query(Package)
+ title = _(u'IATI Registry - All activities')
+ feed_guid=u'tag:iatiregistry.org,2011:/feeds/global'
+
+ return self._build_feed(records,title,feed_guid)
+
+ def publisher(self,id):
+ pass
+
+ def region(self,id):
+ pass
+
+ def _build_feed(self,records,title = _(u'IATI Registry'),feed_guid = None):
+ feed = Rss201rev2Feed(
+ title=title,
+ link= 'http://iatiregistry.org',
+ description=_(''),
+ language=unicode(get_lang()),
+ author_name=_(u'IATI Registry'),
+ author_link=u'http://iatiregistry.org',
+ feed_guid=feed_guid,
+ )
+
+ for record in records:
+ feed.add_item(
+ title=record.title,
+ link=url_for(controller='package', action='read', id=record.id),
+ description=record.notes,
+ enclosure=record.resources[0].url if len(record.resources) > 0 else None
+ )
+ """,
+ pubdate=entry.creation_date,
+ unique_id=entry.get_id(),
+ author_name=entry.user.name,
+ categories=tags
+ """
+
+ response.content_type = "application/rss+xml"
+
+ return feed.writeString("utf-8")
--- a/ckanext/iati/theme.py Fri Jul 01 10:26:54 2011 +0100
+++ b/ckanext/iati/theme.py Fri Jul 15 11:44:38 2011 +0100
@@ -24,4 +24,13 @@
config['extra_template_paths'] = ','.join([template_dir,
config.get('extra_template_paths', '')])
+class IatiFeedsExtension(SingletonPlugin):
+ implements(IRoutes, inherit=True)
+ def before_map(self, map):
+ controller = 'ckanext.iati.feeds:FeedsController'
+ map.connect('/feeds/global.rss', controller=controller, action='all')
+ map.connect('/feeds/publisher/{id}.rss', controller=controller, action='publisher')
+ map.connect('/feeds/region/{id}.rss', controller=controller, action='region')
+ return map
+
--- a/setup.py Fri Jul 01 10:26:54 2011 +0100
+++ b/setup.py Fri Jul 15 11:44:38 2011 +0100
@@ -27,6 +27,7 @@
[ckan.plugins]
iati_theme = ckanext.iati.theme:IatiThemeExtension
+ iati_feeds = ckanext.iati.theme:IatiFeedsExtension
iati_preview = ckanext.iati.preview:IatiPackagePreviewExtension
iati_approval = ckanext.iati.approval:IatiGroupApprovalExtension
iati_group_authz = ckanext.iati.authz:IatiGroupAuthzExtension
http://bitbucket.org/okfn/ckanextiati/changeset/0081ab031518/
changeset: 0081ab031518
user: amercader
date: 2011-09-01 14:59:13
summary: Fix for compatibility with latest CKAN version
affected #: 1 file (6 bytes)
--- a/ckanext/iati/templates/_util_local.html Fri Jul 15 11:48:34 2011 +0100
+++ b/ckanext/iati/templates/_util_local.html Thu Sep 01 13:59:13 2011 +0100
@@ -9,7 +9,7 @@
standard package listing --><ul py:def="package_list_local(packages)" class="packages"><li py:for="package in packages"
- class="${'fullyopen' if (package.isopen() and package.resources) else None}">
+ class="${'fullyopen' if (package.isopen and package.resources) else None}"><div class="header"><span class="title">
${h.link_to(package.title or package.name, h.url_for(controller='package', action='read', id=package.name))}
@@ -26,7 +26,7 @@
</ul></py:if><ul class="openness">
- <py:if test="package.isopen()">
+ <py:if test="package.isopen"><li><a href="http://opendefinition.org/okd/" title="This package satisfies the Open Definition."><img src="http://assets.okfn.org/images/ok_buttons/od_80x15_blue.png" alt="[Open Data]" />
@@ -38,7 +38,7 @@
</a></li></py:if>
- <py:if test="not package.isopen()">
+ <py:if test="not package.isopen"><li><span class="closed">
${h.icon('lock')} Not Openly Licensed
http://bitbucket.org/okfn/ckanextiati/changeset/cf961ba74350/
changeset: cf961ba74350
user: amercader
date: 2011-09-01 14:59:28
summary: Enable flash messages
affected #: 2 files (300 bytes)
--- a/ckanext/iati/public/css/overrides.css Thu Sep 01 13:59:13 2011 +0100
+++ b/ckanext/iati/public/css/overrides.css Thu Sep 01 13:59:28 2011 +0100
@@ -560,6 +560,7 @@
color:#536FA1;
}
+/*-------- Flash messages --------*/
/*-------- Wordpress Specific --------*/
--- a/ckanext/iati/templates/layout_base.html Thu Sep 01 13:59:13 2011 +0100
+++ b/ckanext/iati/templates/layout_base.html Thu Sep 01 13:59:28 2011 +0100
@@ -132,7 +132,15 @@
</div><!-- #masthead --></div><!-- #header -->
- <div id="main">
+ <div id="main">
+ <py:with vars="messages = list(h._flash.pop_messages())">
+ <div class="flash-banner-box" py:if="len(messages)">
+ <div class="flash-banner ${m.category}" py:for="m in messages">
+ ${m.message}
+ </div>
+ </div>
+ </py:with>
+
<div id="container"><div id="content" role="main">
Repository URL: https://bitbucket.org/okfn/ckanextiati/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the ckan-changes
mailing list