[ckan-dev] implimenting stream filters

Stefan Oderbolz stefan.oderbolz at liip.ch
Thu Oct 3 13:49:25 UTC 2013


No, I think this is the most up-to-date documentation. I'd suggest you have
a look at the documentation about "Theming" if you want to change the
frontend of CKAN (http://docs.ckan.org/en/ckan-docs-theme/theming.html).


On Thu, Oct 3, 2013 at 3:13 PM, Koebrick, Andrew (MNIT) <
andrew.koebrick at state.mn.us> wrote:

>  Stefan,****
>
> ** **
>
> Thanks for the tips, I will play around.  I had thought that the Genshi
> was deprecated, but then saw it documented here:****
>
>
> http://docs.ckan.org/en/ckan-docs-theme/writing-extensions.html#example-extensionwhich is marked as “CKAN Documentation 2.2a documentation”.
> ****
>
>
> As I continue to get into the guts of the code, is there an accurate
> up-to-date location I can look to for documentation?****
>
> ** **
>
> Andrew****
>
> ** **
>
> *From:* ckan-dev-bounces at lists.okfn.org [mailto:
> ckan-dev-bounces at lists.okfn.org] *On Behalf Of *Stefan Oderbolz
> *Sent:* Thursday, October 03, 2013 2:34 AM
> *To:* CKAN Development Discussions
> *Subject:* Re: [ckan-dev] implimenting stream filters****
>
> ** **
>
> Hi Andrew,****
>
> ** **
>
> afaik IGenshiStreamFilter is deprecated and you shouldn't use it anymore.*
> ***
>
> ** **
>
> But there are several ways to achieve what you want. By default CKAN shows
> the key of each extra-fields as-is (you can find the code here:
> https://github.com/okfn/ckan/blob/master/ckan/templates/package/snippets/additional_info.html#L61
> ). ****
>
> ** **
>
> As you can see the displayed text is translated, so this would be one way
> to change the name that is displayed (e.g. you could specify "dsOriginator"
> should be translated to "Originator").****
>
> ** **
>
> Another way would be to override the "additional_info.html" template, so
> that for each displayed key the "ds" prefix is getting removed, something
> like****
>
> <span scope="row" class="dataset-label" property="rdfs:label">{{
> _(key)|replace('ds', '') }}</span>****
>
> ** **
>
> Note that this might fail if you have keys that contain "ds", a regex
> would be a better approach.****
>
> ** **
>
> ** **
>
> ** **
>
> On Wed, Oct 2, 2013 at 11:08 PM, Koebrick, Andrew (MNIT) <
> andrew.koebrick at state.mn.us> wrote:****
>
> I am attempting to make an extension that customizes the output of some
> additional fields associated with datasets in our ckan setup.  For example,
> we have fields called “dsOriginator” which I would like to have displayed
> as just “Originator”.  I know the extension is at least partially
> functional since it is pulling our custom templates, but it does not seem
> to do the transform as expectedLive example at:
> http://devel.gisdata.mn.gov/dataset/base-2008-naip-airphotos-cir-wms****
>
>  ****
>
> I would be grateful for any pointers.  ****
>
> ++++++++++++++++++++++++++++++++++++++++++****
>
>  ****
>
> from pylons import config****
>
> from pylons import request****
>
> from genshi.input import HTML****
>
> from genshi.filters import Transformer****
>
> from ckan.plugins import IGenshiStreamFilter****
>
>  ****
>
> import ckan.plugins as plugins****
>
>  ****
>
> class geodatamn(plugins.SingletonPlugin):****
>
>    plugins.implements(plugins.IConfigurer, inherit=True)****
>
>    plugins.implements(IGenshiStreamFilter, inherit=True)****
>
>  ****
>
>  ****
>
>    def update_config(self, config):****
>
>         plugins.toolkit.add_template_directory(config, 'templates')****
>
>  ****
>
>    def filter(self, stream):****
>
>         """Update metadata field names to be human readable****
>
>         """****
>
>         stream = stream | Transformer('body').substitute('dsOriginator',
> 'Originator')****
>
>  ****
>
>         return stream****
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++****
>
>  ****
>
> *Andrew Koebrick  | * MINNESOTA GEOSPATIAL INFORMATION OFFICE****
>
> Web Coordinator / Systems administrator / Librarian****
>
> MN.IT Services @ CENTRAL****
>
> 651-201-2465 (w)  *|  * 651-296-6398 (f) *|*  andrew.koebrick at state.mn.us*
> ***
>
> 658 Cedar St., Room 300, St. Paul, MN 55155, www.mngeo.state.mn.us****
>
> **** <http://www.mn.gov/oet>
>
> Information Technology for Minnesota Government   *|*   *mn.gov/oet*****<http://www.mn.gov/oet>
>
>  **** <http://www.mn.gov/oet>
>
>  **** <http://www.mn.gov/oet>
>
>
> _______________________________________________
> ckan-dev mailing list
> *ckan-dev at lists.okfn.org*
> *http://lists.okfn.org/mailman/listinfo/ckan-dev*
> Unsubscribe: *http://lists.okfn.org/mailman/options/ckan-dev*****<http://www.mn.gov/oet>
>
>
>
> **** <http://www.mn.gov/oet>
>
> ** ** <http://www.mn.gov/oet>
>
> -- **** <http://www.mn.gov/oet>
>
> Liip AG  //  Feldstrasse 133 //  CH-8004 Zurich
> Tel +41 43 500 39 80 // GnuPG 0x7B588C67 // *www.liip.ch*****<http://www.mn.gov/oet>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>
>


-- 
Liip AG  //  Feldstrasse 133 //  CH-8004 Zurich
Tel +41 43 500 39 80 // GnuPG 0x7B588C67 // www.liip.ch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20131003/5c9241ef/attachment-0001.html>


More information about the ckan-dev mailing list