diff --git a/ckan/config/routing.py b/ckan/config/routing.py index c8fc7c9c1d6..a2ab58634b0 100644 --- a/ckan/config/routing.py +++ b/ckan/config/routing.py @@ -194,9 +194,6 @@ def make_map(): ) m.connect('/dataset/{id}.{format}', action='read') m.connect('/dataset/{id}', action='read') - - m.connect('/datapreview/{resource_id}', action='data_preview') - m.connect('/dataset/{id}/resource/{resource_id}', action='resource_read') m.connect('/dataset/{id}/resource/{resource_id}/download', diff --git a/ckan/controllers/package.py b/ckan/controllers/package.py index ec5f69841e6..dff9a15c8a2 100644 --- a/ckan/controllers/package.py +++ b/ckan/controllers/package.py @@ -794,21 +794,6 @@ def resource_read(self, id, resource_id): c.related_count = c.pkg.related_count return render('package/resource_read.html') - def data_preview(self, resource_id): - context = {'model': model, 'session': model.Session, - 'user': c.user or c.author} - - try: - c.resource = get_action('resource_show')(context, - {'id': resource_id}) - c.resource_json = json.dumps(c.resource) - c.pkg_dict = c.package - except NotFound: - abort(404, _('Resource not found')) - except NotAuthorized: - abort(401, _('Unauthorized to read resource %s') % id) - return render('package/datapreview.html') - def resource_download(self, id, resource_id): """ Provides a direct download by redirecting the user to the url stored diff --git a/ckan/public/scripts/application.js b/ckan/public/scripts/application.js index 34a78deb418..87cba35b006 100644 --- a/ckan/public/scripts/application.js +++ b/ckan/public/scripts/application.js @@ -46,11 +46,6 @@ CKAN.Utils = CKAN.Utils || {}; CKAN.DataPreview.loadPreviewDialog(preload_resource); } - var isResourceViewNew = $('#ckanext-datapreview').length > 0; - if (isResourceViewNew) { - CKAN.DataPreview.loadPreviewDialog(preload_resource); - } - var isEmbededDataviewer = $('body.package.resource_embedded_dataviewer').length > 0; if (isEmbededDataviewer) { CKAN.DataPreview.loadEmbeddedPreview(preload_resource, reclineState); diff --git a/ckanext/datastore/db.py b/ckanext/datastore/db.py index 041fe1830e5..3c645f280b4 100644 --- a/ckanext/datastore/db.py +++ b/ckanext/datastore/db.py @@ -45,7 +45,7 @@ def _get_engine(context, data_dict): engine = _engines.get(connection_url) if not engine: - engine = sqlalchemy.create_engine(connection_url) + engine = sqlalchemy.create_engine(connection_url, echo=True) _engines[connection_url] = engine return engine @@ -429,13 +429,6 @@ def search_data(context, data_dict): _validate_int(limit, 'limit') _validate_int(offset, 'offset') - #convert to ints so that return dict looks correct - data_dict['limit'] = int(limit) - data_dict['offset'] = int(offset) - - ##pretend there is a limit so we get a count - if limit == 0: - limit = 1 sort = _sort(context, data_dict.get('sort'), field_ids) @@ -460,9 +453,6 @@ def search_data(context, data_dict): converted_row = {} if not data_dict['total']: data_dict['total'] = row['_full_count'] - # we have the total now so we do not need any records - if data_dict['limit'] == 0: - break for field in result_fields: converted_row[field['id']] = convert(row[field['id']], field['type']) diff --git a/ckanext/datastore/tests/test_datastore.py b/ckanext/datastore/tests/test_datastore.py index ed381fe6767..4dd3fc43cb7 100644 --- a/ckanext/datastore/tests/test_datastore.py +++ b/ckanext/datastore/tests/test_datastore.py @@ -575,33 +575,6 @@ def test_search_limit(self): assert result['total'] == 2 assert result['records'] == [self.expected_records[0]] - - data = {'resource_id': self.data['resource_id'], - 'limit': 0} - postparams = '%s=1' % json.dumps(data) - auth = {'Authorization': str(self.sysadmin_user.apikey)} - res = self.app.post('/api/action/datastore_search', params=postparams, - extra_environ=auth) - res_dict = json.loads(res.body) - assert res_dict['success'] is True - result = res_dict['result'] - assert result['total'] == 2 - assert result['records'] == [] - - #filter returns no results with 0 limit - data = {'resource_id': self.data['resource_id'], - 'limit': 0, - 'filters': {u'b\xfck': 'annakar'}} - postparams = '%s=1' % json.dumps(data) - auth = {'Authorization': str(self.sysadmin_user.apikey)} - res = self.app.post('/api/action/datastore_search', params=postparams, - extra_environ=auth) - res_dict = json.loads(res.body) - assert res_dict['success'] is True - result = res_dict['result'] - assert result['total'] == 0 - assert result['records'] == [] - def test_search_invalid_limit(self): data = {'resource_id': self.data['resource_id'], 'limit': 'bad'}