Created
May 15, 2012 13:30
-
-
Save amercader/2701799 to your computer and use it in GitHub Desktop.
pycsw / CKAn integration proof of concept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CSWController(BaseController): | |
def dispatch(self): | |
import os | |
from pycsw.server import server | |
from pylons import request, response | |
env = request.environ | |
pycsw_config = config.get('ckanext.spatial.pycsw.config') | |
csw = server.Csw(pycsw_config, env) | |
contents = csw.dispatch_wsgi() | |
response.headers['Content-Length'] = str(len(contents)) | |
response.headers['Content-Type'] = csw.contenttype | |
response.status = '200 OK' | |
return contents |
Update: pycsw can now accept configuration as a Python dict as well.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI this would now look like:
Note that you can now pass a SafeConfigParser object of the configuration, which opens up the idea of storing the configuration either in code or a db, and call with something like:
A full working example of integrating pycsw cleanly can be found in OpenDataCatalog: https://github.com/tomkralidis/Open-Data-Catalog/tree/csw