[ckan-changes] commit/ckan: dread: [logic]: #1087 Added status_show action, which will be useful for api clients going forward to see what version it is etc.
Bitbucket
commits-noreply at bitbucket.org
Wed Nov 9 19:14:08 UTC 2011
1 new commit in ckan:
https://bitbucket.org/okfn/ckan/changeset/0b7e2b0bed44/
changeset: 0b7e2b0bed44
user: dread
date: 2011-11-09 20:06:27
summary: [logic]: #1087 Added status_show action, which will be useful for api clients going forward to see what version it is etc.
affected #: 2 files
diff -r 939e0e0809c1a04b6d0d283559294b0c847ae1a4 -r 0b7e2b0bed441c7eb7eef4697d1f0b78595a2f60 ckan/logic/action/get.py
--- a/ckan/logic/action/get.py
+++ b/ckan/logic/action/get.py
@@ -1,6 +1,8 @@
from sqlalchemy.sql import select
from sqlalchemy import or_, and_, func, desc, case
+from pylons import config
+import ckan
from ckan.logic import NotFound
from ckan.logic import check_access
from ckan.plugins import (PluginImplementations,
@@ -746,3 +748,14 @@
q = q.limit(limit)
results = [r for r in q]
return {'count': count, 'results': results}
+
+def status_show(context, data_dict):
+ '''Provides information about the operation of this CKAN instance.'''
+ return {
+ 'site_title': config.get('ckan.site_title'),
+ 'site_description': config.get('ckan.site_description'),
+ 'site_url': config.get('ckan.site_url'),
+ 'ckan_version': ckan.__version__,
+ 'error_emails_to': config.get('email_to'),
+ 'locale_default': config.get('ckan.locale_default'),
+ }
diff -r 939e0e0809c1a04b6d0d283559294b0c847ae1a4 -r 0b7e2b0bed441c7eb7eef4697d1f0b78595a2f60 ckan/tests/functional/api/test_action.py
--- a/ckan/tests/functional/api/test_action.py
+++ b/ckan/tests/functional/api/test_action.py
@@ -3,6 +3,7 @@
from pprint import pprint, pformat
from nose.tools import assert_equal
+import ckan
from ckan.lib.create_test_data import CreateTestData
import ckan.model as model
from ckan.tests import WsgiAppCase
@@ -584,3 +585,11 @@
resource_created.pop('revision_id')
resource_created.pop('revision_timestamp')
assert resource_updated == resource_created
+
+ def test_20_status_show(self):
+ postparams = '%s=1' % json.dumps({})
+ res = self.app.post('/api/action/status_show', params=postparams)
+ status = json.loads(res.body)['result']
+ assert_equal(status['site_title'], 'CKAN')
+ assert_equal(status['ckan_version'], ckan.__version__)
+ assert_equal(status['site_url'], 'http://test.ckan.net')
Repository URL: https://bitbucket.org/okfn/ckan/
--
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