{ "info": { "author": "Open Knowledge", "author_email": "services@okfn.org", "bugtrack_url": null, "classifiers": [], "description": ".. You should enable this project on travis-ci.org and coveralls.io to make\n these badges work. The necessary Travis and Coverage config files have been\n generated for you.\n\n.. image:: https://travis-ci.org/okfn/ckanext-esdstandards.svg?branch=master\n :target: https://travis-ci.org/okfn/ckanext-esdstandards\n\n.. image:: https://coveralls.io/repos/okfn/ckanext-esdstandards/badge.png?branch=master\n :target: https://coveralls.io/r/okfn/ckanext-esdstandards?branch=master\n\n.. image:: https://pypip.in/version/ckanext-esdstandards/badge.svg\n :target: https://pypi.python.org/pypi/ckanext-esdstandards/\n :alt: Latest Version\n\n.. image:: https://pypip.in/py_versions/ckanext-esdstandards/badge.svg\n :target: https://pypi.python.org/pypi/ckanext-esdstandards/\n :alt: Supported Python versions\n\n.. image:: https://pypip.in/license/ckanext-esdstandards/badge.svg\n :target: https://pypi.python.org/pypi/ckanext-esdstandards/\n :alt: License\n\n====================\nckanext-esdstandards\n====================\n\nHelpers for working with LGA's `ESD standards`_ on CKAN.\n\nThis extension contains:\n\n* Action functions for autocomplete lookup for ESD Functions and Services\n\n* Form widgets and validators for easily integrate ESD Functions and Services fields\n into custom schemas (adding the ``la_function`` and ``la_service`` fields,\n supported when harvesting datasets into http://data.gov.uk)\n\n* Snippets for rendering the ESD Functions and Services on the dataset page.\n\n\nFor more details, see `Integrating it on your own extension`_\n\n.. _ESD standards: http://standards.esd.org.uk\n\n------------\nInstallation\n------------\n\nTo install ckanext-esdstandards:\n\n1. Activate your CKAN virtual environment, for example::\n\n source /usr/lib/ckan/default/bin/activate\n\n2. Install the ckanext-esdstandards Python package into your virtual environment::\n\n pip install ckanext-esdstandards\n\n3. Add ``esd`` to the ``ckan.plugins`` setting in your CKAN\n config file (by default the config file is located at\n ``/etc/ckan/default/production.ini``).\n\n4. Populate the DB tables, by running::\n\n paster --plugin=ckanext-esdstandards esd initdb -c /etc/ckan/default/production.ini\n paster --plugin=ckanext-esdstandards esd load -c /etc/ckan/default/production.ini\n\n5. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu::\n\n sudo service apache2 reload\n\n\n------------------------------------\nIntegrating it on your own extension\n------------------------------------\n\nThis extension will not add anything by default to your CKAN instance (apart\nfrom some helper actions and functions). You need to modify the schema and\ntemplates on your project extension to add the fields and widgets.\n\n\nAdding the ``la_function`` and ``la_service`` fields to your custom schema\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\nYou will need to extend the default CKAN schema\nusing the ``IDatasetForm`` interface (as described in the tutorial_).\n\nThe extension provides a couple of validators to use. The fields generated\nshould be stored as extras an named ``la_function`` and ``la_service`` \n(as per Appendix B of the `data.gov.uk harvesting guide`_).\n\n.. _data.gov.uk harvesting guide: http://data.gov.uk/sites/default/files/library/Harvesting%20guide.pdf\n\nThis snippet should be easy enough to follow (**note**: this assumes CKAN>=2.3)::\n\n import ckan.plugins as plugins\n import ckan.plugins.toolkit as toolkit\n\n\n class MyPlugin(plugins.SingletonPlugin, toolkit.DefaultDatasetForm):\n plugins.implements(plugins.IDatasetForm)\n\n\n # IDatasetForm\n\n def _modify_package_schema(self, schema):\n schema.update({\n 'la_function': [toolkit.get_validator('ignore_missing'),\n toolkit.get_validator('esd_function_validator'),\n toolkit.get_converter('convert_to_extras')],\n 'la_service': [toolkit.get_validator('ignore_missing'),\n toolkit.get_validator('esd_service_validator'),\n toolkit.get_converter('convert_to_extras')],\n })\n return schema\n\n def create_package_schema(self):\n schema = super(MyPlugin, self).create_package_schema()\n schema = self._modify_package_schema(schema)\n return schema\n\n def update_package_schema(self):\n schema = super(MyPlugin, self).update_package_schema()\n schema = self._modify_package_schema(schema)\n return schema\n\n def show_package_schema(self):\n schema = super(MyPlugin, self).show_package_schema()\n default_validators = [toolkit.get_converter('convert_from_extras'),\n toolkit.get_validator('ignore_missing')]\n\n schema.update({\n 'la_function': default_validators,\n 'la_service': default_validators,\n })\n return schema\n\nOn CKAN versions lower than 2.3, the validators need to be explicitly imported::\n\n import ckan.plugins as plugins\n import ckan.plugins.toolkit as toolkit\n\n from ckanext.esdstandards.validators import (esd_function_validator,\n esd_service_validator)\n\n class MyPlugin(plugins.SingletonPlugin, toolkit.DefaultDatasetForm):\n plugins.implements(plugins.IDatasetForm)\n\n\n # IDatasetForm\n\n def _modify_package_schema(self, schema):\n schema.update({\n 'la_function': [toolkit.get_validator('ignore_missing'),\n esd_function_validator,\n toolkit.get_converter('convert_to_extras')],\n 'la_service': [toolkit.get_validator('ignore_missing'),\n esd_service_validator,\n toolkit.get_converter('convert_to_extras')],\n })\n return schema\n\n def create_package_schema(self):\n schema = super(MyPlugin, self).create_package_schema()\n schema = self._modify_package_schema(schema)\n return schema\n\n def update_package_schema(self):\n schema = super(MyPlugin, self).update_package_schema()\n schema = self._modify_package_schema(schema)\n return schema\n\n def show_package_schema(self):\n schema = super(MyPlugin, self).show_package_schema()\n default_validators = [toolkit.get_converter('convert_from_extras'),\n toolkit.get_validator('ignore_missing')]\n\n schema.update({\n 'la_function': default_validators,\n 'la_service': default_validators,\n })\n return schema\n\n\n.. _tutorial: http://docs.ckan.org/en/latest/extensions/adding-custom-fields.html\n\n\nAdding the Functions and Services fields to the dataset form\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\nThe extension provides two covenient snippets that will add all the necessary\nmarkup and scripts to the templates. You need to extend the ``package_basic_fields.html``\ntemplate on your own extension with the following::\n\n # ckanext-yourext/ckanext/yourext/templates/package/snippets/package_basic_fields.html\n\n {% ckan_extends %}\n\n {% block package_basic_fields_custom %}\n\n {% snippet 'snippets/esd_functions.html', data=data, errors=errors %}\n\n {% snippet 'snippets/esd_services.html', data=data, errors=errors %}\n\n {% endblock %}\n\n\nYou should see a couple of new fields added, similar to the one for defining tags:\n\n.. image:: http://i.imgur.com/sPqeK7q.png\n\nAdding the field values on the dataset page\n+++++++++++++++++++++++++++++++++++++++++++\n\nJust extend the ``additional_info.html`` template on your own extension with the following::\n\n # ckanext-yourext/ckanext/yourext/templates/package/snippets/additional_info.html\n\n {% ckan_extends %}\n\n {% block extras %}\n\n {{ super() }}\n\n {% snippet 'snippets/esd_functions_additional_info.html', data=pkg_dict %}\n\n {% snippet 'snippets/esd_services_additional_info.html', data=pkg_dict %}\n\n {% endblock %}\n\nYou can pass ``display_row_if_missing=False`` to the snippet to completely hide the\nrow if no values are defined.\n\nThe snippets will show the fields rendered like that:\n\n.. image:: http://i.imgur.com/0HFUwcw.png\n\n\n\n------------------------\nDevelopment Installation\n------------------------\n\nTo install ckanext-esdstandards for development, activate your CKAN virtualenv and\ndo::\n\n git clone https://github.com/okfn/ckanext-esdstandards.git\n cd ckanext-esdstandards\n python setup.py develop\n\n\n-----------------\nRunning the Tests\n-----------------\n\nTo run the tests, do::\n\n nosetests --nologcapture --ckan --with-pylons=test.ini\n\n\n----------------------------------------\nRegistering ckanext-esdstandards on PyPI\n----------------------------------------\n\nckanext-esdstandards should be availabe on PyPI as\nhttps://pypi.python.org/pypi/ckanext-esdstandards. If that link doesn't work, then\nyou can register the project on PyPI for the first time by following these\nsteps:\n\n1. Create a source distribution of the project::\n\n python setup.py sdist\n\n2. Register the project::\n\n python setup.py register\n\n3. Upload the source distribution to PyPI::\n\n python setup.py sdist upload\n\n4. Tag the first release of the project on GitHub with the version number from\n the ``setup.py`` file. For example if the version number in ``setup.py`` is\n 0.0.1 then do::\n\n git tag 0.0.1\n git push --tags\n\n\n-----------------------------------------------\nReleasing a New Version of ckanext-esdstandards\n-----------------------------------------------\n\nckanext-esdstandards is availabe on PyPI as https://pypi.python.org/pypi/ckanext-esdstandards.\nTo publish a new version to PyPI follow these steps:\n\n1. Update the version number in the ``setup.py`` file.\n See `PEP 440 `_\n for how to choose version numbers.\n\n2. Create a source distribution of the new version::\n\n python setup.py sdist\n\n3. Upload the source distribution to PyPI::\n\n python setup.py sdist upload\n\n4. Tag the new release of the project on GitHub with the version number from\n the ``setup.py`` file. For example if the version number in ``setup.py`` is\n 0.0.2 then do::\n\n git tag 0.0.2\n git push --tags\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/okfn/ckanext-esdstandards", "keywords": "", "license": "AGPL", "maintainer": null, "maintainer_email": null, "name": "ckanext-esdstandards", "package_url": "https://pypi.org/project/ckanext-esdstandards/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ckanext-esdstandards/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/okfn/ckanext-esdstandards" }, "release_url": "https://pypi.org/project/ckanext-esdstandards/0.0.6/", "requires_dist": null, "requires_python": null, "summary": "Helpers for working with LGA's ESD standards on CKAN", "version": "0.0.6" }, "last_serial": 1468363, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "8092a4bd8b9f241b583eac3f345adda2", "sha256": "39b7d33c3af6ecf2d8958258cff0152a8a420a4048b6cc671428971381d982a1" }, "downloads": -1, "filename": "ckanext-esdstandards-0.0.1.tar.gz", "has_sig": false, "md5_digest": "8092a4bd8b9f241b583eac3f345adda2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10116, "upload_time": "2015-03-17T13:46:06", "url": "https://files.pythonhosted.org/packages/b1/2d/d245ae85906a063e895571daf968707b851903f29131e5c0800b84994f2f/ckanext-esdstandards-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "fafa641bcce83bf91303fb7f755c5998", "sha256": "236474907d77683475fefe409a79b944775a2c22b8ca68571a4e8f9cfceca32f" }, "downloads": -1, "filename": "ckanext-esdstandards-0.0.2.tar.gz", "has_sig": false, "md5_digest": "fafa641bcce83bf91303fb7f755c5998", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 172174, "upload_time": "2015-03-17T14:26:22", "url": "https://files.pythonhosted.org/packages/ba/ba/a8d9350232aca66b4ac02d587b93e352534c94e240594f8b73fc88cb9fbd/ckanext-esdstandards-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "9116f865d5325ec60e8d796b25e01130", "sha256": "6f3206d58f1300a96939d5fd56a2578b5d619d1dfbe302d61a6fb3fb8ec6a8cc" }, "downloads": -1, "filename": "ckanext-esdstandards-0.0.3.tar.gz", "has_sig": false, "md5_digest": "9116f865d5325ec60e8d796b25e01130", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 172612, "upload_time": "2015-03-17T15:38:04", "url": "https://files.pythonhosted.org/packages/11/09/8e2dc459000435c1f013f4d25eda2c6405d098d655da1f2db315a9d56760/ckanext-esdstandards-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "59f9e09d874bc748bcee66550fded60f", "sha256": "7ece21d57c44b89f5bf345aad0b12220c019ff6d6e520f2167f79192e2864e33" }, "downloads": -1, "filename": "ckanext-esdstandards-0.0.4.tar.gz", "has_sig": false, "md5_digest": "59f9e09d874bc748bcee66550fded60f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 176930, "upload_time": "2015-03-17T15:52:59", "url": "https://files.pythonhosted.org/packages/76/c7/4d676b5306bd0b2a8215b3836125416b6f7bb323225138a8a494145ba165/ckanext-esdstandards-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "a44d7acd3a5d70ab41ab0e7f1b6e3dff", "sha256": "5a5195becb812ac67512377ec4abcd66960aa57e8a1ea24c02c434013aee8289" }, "downloads": -1, "filename": "ckanext-esdstandards-0.0.5.tar.gz", "has_sig": false, "md5_digest": "a44d7acd3a5d70ab41ab0e7f1b6e3dff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 176938, "upload_time": "2015-03-18T09:24:09", "url": "https://files.pythonhosted.org/packages/fe/e3/d46b42874cb3ac29b3c67f968a745e75ecc9dd4f0cdfe85d8cdf12981abd/ckanext-esdstandards-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "36230b39df8fea34e3f5610af517f7aa", "sha256": "0bb763133c41b7641dda7823f24305e0a453655a28959a3eb1775740a0330e65" }, "downloads": -1, "filename": "ckanext-esdstandards-0.0.6.tar.gz", "has_sig": false, "md5_digest": "36230b39df8fea34e3f5610af517f7aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 176988, "upload_time": "2015-03-19T11:40:44", "url": "https://files.pythonhosted.org/packages/5a/1c/c4ad45431337778a280959352182ce0287fd652ce75921834680a37e6547/ckanext-esdstandards-0.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "36230b39df8fea34e3f5610af517f7aa", "sha256": "0bb763133c41b7641dda7823f24305e0a453655a28959a3eb1775740a0330e65" }, "downloads": -1, "filename": "ckanext-esdstandards-0.0.6.tar.gz", "has_sig": false, "md5_digest": "36230b39df8fea34e3f5610af517f7aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 176988, "upload_time": "2015-03-19T11:40:44", "url": "https://files.pythonhosted.org/packages/5a/1c/c4ad45431337778a280959352182ce0287fd652ce75921834680a37e6547/ckanext-esdstandards-0.0.6.tar.gz" } ] }