[ckan-dev] implimenting stream filters

Koebrick, Andrew (MNIT) andrew.koebrick at state.mn.us
Wed Oct 2 21:08:36 UTC 2013


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<mailto:andrew.koebrick at state.mn.us>
658 Cedar St., Room 300, St. Paul, MN 55155, www.mngeo.state.mn.us<http://www.mngeo.state.mn.us/>

[cid:image002.jpg at 01CE61F8.52552AE0]<http://www.mn.gov/oet>

Information Technology for Minnesota Government   |   mn.gov/oet<http://www.mn.gov/oet>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20131002/b5481dc6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 1624 bytes
Desc: image001.jpg
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20131002/b5481dc6/attachment-0002.jpg>


More information about the ckan-dev mailing list