diff --git a/tests/test_datasources_admin_pages.py b/tests/test_datasources_admin_pages.py index c5a158321..c700fe8af 100644 --- a/tests/test_datasources_admin_pages.py +++ b/tests/test_datasources_admin_pages.py @@ -81,6 +81,14 @@ def test_data_sources_new(pub): resp = resp.click('New Data Source') resp.forms[0]['name'] = 'a new data source' resp.forms[0]['description'] = 'description of the data source' + + assert resp.form['data_source$type'].options == [ + ('None', True, 'None'), + ('json', False, 'JSON URL'), + ('jsonp', False, 'JSONP URL'), + ('geojson', False, 'GeoJSON URL'), + ('python', False, 'Python Expression') + ] resp.forms[0]['data_source$type'] = 'python' resp = resp.forms[0].submit('data_source$apply') resp.forms[0]['data_source$value'] = repr( diff --git a/tests/test_forms_admin_pages.py b/tests/test_forms_admin_pages.py index ed6a1c0f5..33f712493 100644 --- a/tests/test_forms_admin_pages.py +++ b/tests/test_forms_admin_pages.py @@ -1435,7 +1435,6 @@ def test_form_edit_item_field_data_source(pub): (u'None', True, u'None'), (u'json', False, u'JSON URL'), (u'jsonp', False, u'JSONP URL'), - (u'geojson', False, u'GeoJSON URL'), (u'python', False, u'Python Expression') ] resp = resp.form.submit('submit').follow() @@ -1450,7 +1449,6 @@ def test_form_edit_item_field_data_source(pub): (u'foobar', False, u'Foobar'), (u'json', False, u'JSON URL'), (u'jsonp', False, u'JSONP URL'), - (u'geojson', False, u'GeoJSON URL'), (u'python', False, u'Python Expression') ] resp.form['data_source$type'].value = 'foobar' @@ -1467,7 +1465,6 @@ def test_form_edit_item_field_data_source(pub): (u'foobar', True, u'Foobar'), (u'json', False, u'JSON URL'), (u'jsonp', False, u'JSONP URL'), - (u'geojson', False, u'GeoJSON URL'), (u'python', False, u'Python Expression') ] @@ -1481,7 +1478,6 @@ def test_form_edit_item_field_data_source(pub): (u'foobar', True, u'Foobar'), (u'json', False, u'JSON URL'), (u'jsonp', False, u'JSONP URL'), - (u'geojson', False, u'GeoJSON URL'), (u'python', False, u'Python Expression') ] diff --git a/wcs/admin/data_sources.py b/wcs/admin/data_sources.py index 6a8b8ef8a..28267177e 100644 --- a/wcs/admin/data_sources.py +++ b/wcs/admin/data_sources.py @@ -58,6 +58,7 @@ class NamedDataSourceUI(object): form.add(DataSourceSelectionWidget, 'data_source', value=self.datasource.data_source, title=_('Data Source'), + allow_geojson=True, allow_named_sources=False, required=True) form.add(DurationWidget, 'cache_duration', diff --git a/wcs/data_sources.py b/wcs/data_sources.py index d7c44e63d..20f640d25 100644 --- a/wcs/data_sources.py +++ b/wcs/data_sources.py @@ -52,7 +52,7 @@ def register_data_source_function(function, function_name=None): class DataSourceSelectionWidget(CompositeWidget): def __init__(self, name, value=None, allow_jsonp=True, - allow_named_sources=True, **kwargs): + allow_geojson=False, allow_named_sources=True, **kwargs): CompositeWidget.__init__(self, name, value, **kwargs) if not value: @@ -72,7 +72,8 @@ class DataSourceSelectionWidget(CompositeWidget): options.append(('json', _('JSON URL'), 'json')) if allow_jsonp: options.append(('jsonp', _('JSONP URL'), 'jsonp')) - options.append(('geojson', _('GeoJSON URL'), 'geojson')) + if allow_geojson: + options.append(('geojson', _('GeoJSON URL'), 'geojson')) options.append(('formula', _('Python Expression'), 'python')) self.add(SingleSelectWidget, 'type', options=options, value=value.get('type'),