We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Allow to customize the DataProxy URL
This will allow users that really want to use it to host their own instance

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ckanext/reclineview/plugin.py`
Content:
```
1 # encoding: utf-8
2 
3 from logging import getLogger
4 
5 from ckan.common import json, config
6 import ckan.plugins as p
7 import ckan.plugins.toolkit as toolkit
8 
9 log = getLogger(__name__)
10 ignore_empty = p.toolkit.get_validator('ignore_empty')
11 natural_number_validator = p.toolkit.get_validator('natural_number_validator')
12 Invalid = p.toolkit.Invalid
13 
14 
15 def get_mapview_config():
16     '''
17     Extracts and returns map view configuration of the reclineview extension.
18     '''
19     namespace = 'ckanext.spatial.common_map.'
20     return dict([(k.replace(namespace, ''), v) for k, v in config.iteritems()
21                  if k.startswith(namespace)])
22 
23 
24 def in_list(list_possible_values):
25     '''
26     Validator that checks that the input value is one of the given
27     possible values.
28 
29     :param list_possible_values: function that returns list of possible values
30         for validated field
31     :type possible_values: function
32     '''
33     def validate(key, data, errors, context):
34         if not data[key] in list_possible_values():
35             raise Invalid('"{0}" is not a valid parameter'.format(data[key]))
36     return validate
37 
38 
39 def datastore_fields(resource, valid_field_types):
40     '''
41     Return a list of all datastore fields for a given resource, as long as
42     the datastore field type is in valid_field_types.
43 
44     :param resource: resource dict
45     :type resource: dict
46     :param valid_field_types: field types to include in returned list
47     :type valid_field_types: list of strings
48     '''
49     data = {'resource_id': resource['id'], 'limit': 0}
50     fields = toolkit.get_action('datastore_search')({}, data)['fields']
51     return [{'value': f['id'], 'text': f['id']} for f in fields
52             if f['type'] in valid_field_types]
53 
54 
55 class ReclineViewBase(p.SingletonPlugin):
56     '''
57     This base class for the Recline view extensions.
58     '''
59     p.implements(p.IConfigurer, inherit=True)
60     p.implements(p.IResourceView, inherit=True)
61     p.implements(p.ITemplateHelpers, inherit=True)
62 
63     def update_config(self, config):
64         '''
65         Set up the resource library, public directory and
66         template directory for the view
67         '''
68         toolkit.add_public_directory(config, 'theme/public')
69         toolkit.add_template_directory(config, 'theme/templates')
70         toolkit.add_resource('theme/public', 'ckanext-reclineview')
71 
72     def can_view(self, data_dict):
73         resource = data_dict['resource']
74         return (resource.get('datastore_active') or
75                 '_datastore_only_resource' in resource.get('url', ''))
76 
77     def setup_template_variables(self, context, data_dict):
78         return {'resource_json': json.dumps(data_dict['resource']),
79                 'resource_view_json': json.dumps(data_dict['resource_view'])}
80 
81     def view_template(self, context, data_dict):
82         return 'recline_view.html'
83 
84     def get_helpers(self):
85         return {
86             'get_map_config': get_mapview_config
87         }
88 
89 
90 class ReclineView(ReclineViewBase):
91     '''
92     This extension views resources using a Recline MultiView.
93     '''
94 
95     def info(self):
96         return {'name': 'recline_view',
97                 'title': 'Data Explorer',
98                 'filterable': True,
99                 'icon': 'table',
100                 'requires_datastore': False,
101                 'default_title': p.toolkit._('Data Explorer'),
102                 }
103 
104     def can_view(self, data_dict):
105         resource = data_dict['resource']
106 
107         if (resource.get('datastore_active') or
108                 '_datastore_only_resource' in resource.get('url', '')):
109             return True
110         resource_format = resource.get('format', None)
111         if resource_format:
112             return resource_format.lower() in ['csv', 'xls', 'xlsx', 'tsv']
113         else:
114             return False
115 
116 
117 class ReclineGridView(ReclineViewBase):
118     '''
119     This extension views resources using a Recline grid.
120     '''
121 
122     def info(self):
123         return {'name': 'recline_grid_view',
124                 'title': 'Grid',
125                 'filterable': True,
126                 'icon': 'table',
127                 'requires_datastore': True,
128                 'default_title': p.toolkit._('Table'),
129                 }
130 
131 
132 class ReclineGraphView(ReclineViewBase):
133     '''
134     This extension views resources using a Recline graph.
135     '''
136 
137     graph_types = [{'value': 'lines-and-points',
138                     'text': 'Lines and points'},
139                    {'value': 'lines', 'text': 'Lines'},
140                    {'value': 'points', 'text': 'Points'},
141                    {'value': 'bars', 'text': 'Bars'},
142                    {'value': 'columns', 'text': 'Columns'}]
143 
144     datastore_fields = []
145 
146     datastore_field_types = ['numeric', 'int4', 'timestamp']
147 
148     def list_graph_types(self):
149         return [t['value'] for t in self.graph_types]
150 
151     def list_datastore_fields(self):
152         return [t['value'] for t in self.datastore_fields]
153 
154     def info(self):
155         # in_list validator here is passed functions because this
156         # method does not know what the possible values of the
157         # datastore fields are (requires a datastore search)
158         schema = {
159             'offset': [ignore_empty, natural_number_validator],
160             'limit': [ignore_empty, natural_number_validator],
161             'graph_type': [ignore_empty, in_list(self.list_graph_types)],
162             'group': [ignore_empty, in_list(self.list_datastore_fields)],
163             'series': [ignore_empty, in_list(self.list_datastore_fields)]
164         }
165         return {'name': 'recline_graph_view',
166                 'title': 'Graph',
167                 'filterable': True,
168                 'icon': 'bar-chart-o',
169                 'requires_datastore': True,
170                 'schema': schema,
171                 'default_title': p.toolkit._('Graph'),
172                 }
173 
174     def setup_template_variables(self, context, data_dict):
175         self.datastore_fields = datastore_fields(data_dict['resource'],
176                                                  self.datastore_field_types)
177         vars = ReclineViewBase.setup_template_variables(self, context,
178                                                         data_dict)
179         vars.update({'graph_types': self.graph_types,
180                      'graph_fields': self.datastore_fields})
181         return vars
182 
183     def form_template(self, context, data_dict):
184         return 'recline_graph_form.html'
185 
186 
187 class ReclineMapView(ReclineViewBase):
188     '''
189     This extension views resources using a Recline map.
190     '''
191 
192     map_field_types = [{'value': 'lat_long',
193                         'text': 'Latitude / Longitude fields'},
194                        {'value': 'geojson', 'text': 'GeoJSON'}]
195 
196     datastore_fields = []
197 
198     datastore_field_latlon_types = ['numeric']
199 
200     datastore_field_geojson_types = ['text']
201 
202     def list_map_field_types(self):
203         return [t['value'] for t in self.map_field_types]
204 
205     def list_datastore_fields(self):
206         return [t['value'] for t in self.datastore_fields]
207 
208     def info(self):
209         # in_list validator here is passed functions because this
210         # method does not know what the possible values of the
211         # datastore fields are (requires a datastore search)
212         schema = {
213             'offset': [ignore_empty, natural_number_validator],
214             'limit': [ignore_empty, natural_number_validator],
215             'map_field_type': [ignore_empty,
216                                in_list(self.list_map_field_types)],
217             'latitude_field': [ignore_empty,
218                                in_list(self.list_datastore_fields)],
219             'longitude_field': [ignore_empty,
220                                 in_list(self.list_datastore_fields)],
221             'geojson_field': [ignore_empty,
222                               in_list(self.list_datastore_fields)],
223             'auto_zoom': [ignore_empty],
224             'cluster_markers': [ignore_empty]
225         }
226         return {'name': 'recline_map_view',
227                 'title': 'Map',
228                 'schema': schema,
229                 'filterable': True,
230                 'icon': 'map-marker',
231                 'default_title': p.toolkit._('Map'),
232                 }
233 
234     def setup_template_variables(self, context, data_dict):
235         map_latlon_fields = datastore_fields(
236             data_dict['resource'], self.datastore_field_latlon_types)
237         map_geojson_fields = datastore_fields(
238             data_dict['resource'], self.datastore_field_geojson_types)
239 
240         self.datastore_fields = map_latlon_fields + map_geojson_fields
241 
242         vars = ReclineViewBase.setup_template_variables(self, context,
243                                                         data_dict)
244         vars.update({'map_field_types': self.map_field_types,
245                      'map_latlon_fields': map_latlon_fields,
246                      'map_geojson_fields': map_geojson_fields
247                      })
248         return vars
249 
250     def form_template(self, context, data_dict):
251         return 'recline_map_form.html'
252
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/ckanext/reclineview/plugin.py b/ckanext/reclineview/plugin.py
--- a/ckanext/reclineview/plugin.py
+++ b/ckanext/reclineview/plugin.py
@@ -21,6 +21,14 @@
                  if k.startswith(namespace)])
 
 
+def get_dataproxy_url():
+    '''
+    Returns the value of the ckan.recline.dataproxy_url config option
+    '''
+    return config.get(
+        'ckan.recline.dataproxy_url', '//jsonpdataproxy.appspot.com')
+
+
 def in_list(list_possible_values):
     '''
     Validator that checks that the input value is one of the given
@@ -83,7 +91,8 @@
 
     def get_helpers(self):
         return {
-            'get_map_config': get_mapview_config
+            'get_map_config': get_mapview_config,
+            'get_dataproxy_url': get_dataproxy_url,
         }

{"golden_diff": "diff --git a/ckanext/reclineview/plugin.py b/ckanext/reclineview/plugin.py\n--- a/ckanext/reclineview/plugin.py\n+++ b/ckanext/reclineview/plugin.py\n@@ -21,6 +21,14 @@\n                  if k.startswith(namespace)])\n \n \n+def get_dataproxy_url():\n+    '''\n+    Returns the value of the ckan.recline.dataproxy_url config option\n+    '''\n+    return config.get(\n+        'ckan.recline.dataproxy_url', '//jsonpdataproxy.appspot.com')\n+\n+\n def in_list(list_possible_values):\n     '''\n     Validator that checks that the input value is one of the given\n@@ -83,7 +91,8 @@\n \n     def get_helpers(self):\n         return {\n-            'get_map_config': get_mapview_config\n+            'get_map_config': get_mapview_config,\n+            'get_dataproxy_url': get_dataproxy_url,\n         }\n", "issue": "Allow to customize the DataProxy URL\nThis will allow users that really want to use it to host their own instance\n", "before_files": [{"content": "# encoding: utf-8\n\nfrom logging import getLogger\n\nfrom ckan.common import json, config\nimport ckan.plugins as p\nimport ckan.plugins.toolkit as toolkit\n\nlog = getLogger(__name__)\nignore_empty = p.toolkit.get_validator('ignore_empty')\nnatural_number_validator = p.toolkit.get_validator('natural_number_validator')\nInvalid = p.toolkit.Invalid\n\n\ndef get_mapview_config():\n    '''\n    Extracts and returns map view configuration of the reclineview extension.\n    '''\n    namespace = 'ckanext.spatial.common_map.'\n    return dict([(k.replace(namespace, ''), v) for k, v in config.iteritems()\n                 if k.startswith(namespace)])\n\n\ndef in_list(list_possible_values):\n    '''\n    Validator that checks that the input value is one of the given\n    possible values.\n\n    :param list_possible_values: function that returns list of possible values\n        for validated field\n    :type possible_values: function\n    '''\n    def validate(key, data, errors, context):\n        if not data[key] in list_possible_values():\n            raise Invalid('\"{0}\" is not a valid parameter'.format(data[key]))\n    return validate\n\n\ndef datastore_fields(resource, valid_field_types):\n    '''\n    Return a list of all datastore fields for a given resource, as long as\n    the datastore field type is in valid_field_types.\n\n    :param resource: resource dict\n    :type resource: dict\n    :param valid_field_types: field types to include in returned list\n    :type valid_field_types: list of strings\n    '''\n    data = {'resource_id': resource['id'], 'limit': 0}\n    fields = toolkit.get_action('datastore_search')({}, data)['fields']\n    return [{'value': f['id'], 'text': f['id']} for f in fields\n            if f['type'] in valid_field_types]\n\n\nclass ReclineViewBase(p.SingletonPlugin):\n    '''\n    This base class for the Recline view extensions.\n    '''\n    p.implements(p.IConfigurer, inherit=True)\n    p.implements(p.IResourceView, inherit=True)\n    p.implements(p.ITemplateHelpers, inherit=True)\n\n    def update_config(self, config):\n        '''\n        Set up the resource library, public directory and\n        template directory for the view\n        '''\n        toolkit.add_public_directory(config, 'theme/public')\n        toolkit.add_template_directory(config, 'theme/templates')\n        toolkit.add_resource('theme/public', 'ckanext-reclineview')\n\n    def can_view(self, data_dict):\n        resource = data_dict['resource']\n        return (resource.get('datastore_active') or\n                '_datastore_only_resource' in resource.get('url', ''))\n\n    def setup_template_variables(self, context, data_dict):\n        return {'resource_json': json.dumps(data_dict['resource']),\n                'resource_view_json': json.dumps(data_dict['resource_view'])}\n\n    def view_template(self, context, data_dict):\n        return 'recline_view.html'\n\n    def get_helpers(self):\n        return {\n            'get_map_config': get_mapview_config\n        }\n\n\nclass ReclineView(ReclineViewBase):\n    '''\n    This extension views resources using a Recline MultiView.\n    '''\n\n    def info(self):\n        return {'name': 'recline_view',\n                'title': 'Data Explorer',\n                'filterable': True,\n                'icon': 'table',\n                'requires_datastore': False,\n                'default_title': p.toolkit._('Data Explorer'),\n                }\n\n    def can_view(self, data_dict):\n        resource = data_dict['resource']\n\n        if (resource.get('datastore_active') or\n                '_datastore_only_resource' in resource.get('url', '')):\n            return True\n        resource_format = resource.get('format', None)\n        if resource_format:\n            return resource_format.lower() in ['csv', 'xls', 'xlsx', 'tsv']\n        else:\n            return False\n\n\nclass ReclineGridView(ReclineViewBase):\n    '''\n    This extension views resources using a Recline grid.\n    '''\n\n    def info(self):\n        return {'name': 'recline_grid_view',\n                'title': 'Grid',\n                'filterable': True,\n                'icon': 'table',\n                'requires_datastore': True,\n                'default_title': p.toolkit._('Table'),\n                }\n\n\nclass ReclineGraphView(ReclineViewBase):\n    '''\n    This extension views resources using a Recline graph.\n    '''\n\n    graph_types = [{'value': 'lines-and-points',\n                    'text': 'Lines and points'},\n                   {'value': 'lines', 'text': 'Lines'},\n                   {'value': 'points', 'text': 'Points'},\n                   {'value': 'bars', 'text': 'Bars'},\n                   {'value': 'columns', 'text': 'Columns'}]\n\n    datastore_fields = []\n\n    datastore_field_types = ['numeric', 'int4', 'timestamp']\n\n    def list_graph_types(self):\n        return [t['value'] for t in self.graph_types]\n\n    def list_datastore_fields(self):\n        return [t['value'] for t in self.datastore_fields]\n\n    def info(self):\n        # in_list validator here is passed functions because this\n        # method does not know what the possible values of the\n        # datastore fields are (requires a datastore search)\n        schema = {\n            'offset': [ignore_empty, natural_number_validator],\n            'limit': [ignore_empty, natural_number_validator],\n            'graph_type': [ignore_empty, in_list(self.list_graph_types)],\n            'group': [ignore_empty, in_list(self.list_datastore_fields)],\n            'series': [ignore_empty, in_list(self.list_datastore_fields)]\n        }\n        return {'name': 'recline_graph_view',\n                'title': 'Graph',\n                'filterable': True,\n                'icon': 'bar-chart-o',\n                'requires_datastore': True,\n                'schema': schema,\n                'default_title': p.toolkit._('Graph'),\n                }\n\n    def setup_template_variables(self, context, data_dict):\n        self.datastore_fields = datastore_fields(data_dict['resource'],\n                                                 self.datastore_field_types)\n        vars = ReclineViewBase.setup_template_variables(self, context,\n                                                        data_dict)\n        vars.update({'graph_types': self.graph_types,\n                     'graph_fields': self.datastore_fields})\n        return vars\n\n    def form_template(self, context, data_dict):\n        return 'recline_graph_form.html'\n\n\nclass ReclineMapView(ReclineViewBase):\n    '''\n    This extension views resources using a Recline map.\n    '''\n\n    map_field_types = [{'value': 'lat_long',\n                        'text': 'Latitude / Longitude fields'},\n                       {'value': 'geojson', 'text': 'GeoJSON'}]\n\n    datastore_fields = []\n\n    datastore_field_latlon_types = ['numeric']\n\n    datastore_field_geojson_types = ['text']\n\n    def list_map_field_types(self):\n        return [t['value'] for t in self.map_field_types]\n\n    def list_datastore_fields(self):\n        return [t['value'] for t in self.datastore_fields]\n\n    def info(self):\n        # in_list validator here is passed functions because this\n        # method does not know what the possible values of the\n        # datastore fields are (requires a datastore search)\n        schema = {\n            'offset': [ignore_empty, natural_number_validator],\n            'limit': [ignore_empty, natural_number_validator],\n            'map_field_type': [ignore_empty,\n                               in_list(self.list_map_field_types)],\n            'latitude_field': [ignore_empty,\n                               in_list(self.list_datastore_fields)],\n            'longitude_field': [ignore_empty,\n                                in_list(self.list_datastore_fields)],\n            'geojson_field': [ignore_empty,\n                              in_list(self.list_datastore_fields)],\n            'auto_zoom': [ignore_empty],\n            'cluster_markers': [ignore_empty]\n        }\n        return {'name': 'recline_map_view',\n                'title': 'Map',\n                'schema': schema,\n                'filterable': True,\n                'icon': 'map-marker',\n                'default_title': p.toolkit._('Map'),\n                }\n\n    def setup_template_variables(self, context, data_dict):\n        map_latlon_fields = datastore_fields(\n            data_dict['resource'], self.datastore_field_latlon_types)\n        map_geojson_fields = datastore_fields(\n            data_dict['resource'], self.datastore_field_geojson_types)\n\n        self.datastore_fields = map_latlon_fields + map_geojson_fields\n\n        vars = ReclineViewBase.setup_template_variables(self, context,\n                                                        data_dict)\n        vars.update({'map_field_types': self.map_field_types,\n                     'map_latlon_fields': map_latlon_fields,\n                     'map_geojson_fields': map_geojson_fields\n                     })\n        return vars\n\n    def form_template(self, context, data_dict):\n        return 'recline_map_form.html'\n", "path": "ckanext/reclineview/plugin.py"}], "after_files": [{"content": "# encoding: utf-8\n\nfrom logging import getLogger\n\nfrom ckan.common import json, config\nimport ckan.plugins as p\nimport ckan.plugins.toolkit as toolkit\n\nlog = getLogger(__name__)\nignore_empty = p.toolkit.get_validator('ignore_empty')\nnatural_number_validator = p.toolkit.get_validator('natural_number_validator')\nInvalid = p.toolkit.Invalid\n\n\ndef get_mapview_config():\n    '''\n    Extracts and returns map view configuration of the reclineview extension.\n    '''\n    namespace = 'ckanext.spatial.common_map.'\n    return dict([(k.replace(namespace, ''), v) for k, v in config.iteritems()\n                 if k.startswith(namespace)])\n\n\ndef get_dataproxy_url():\n    '''\n    Returns the value of the ckan.recline.dataproxy_url config option\n    '''\n    return config.get(\n        'ckan.recline.dataproxy_url', '//jsonpdataproxy.appspot.com')\n\n\ndef in_list(list_possible_values):\n    '''\n    Validator that checks that the input value is one of the given\n    possible values.\n\n    :param list_possible_values: function that returns list of possible values\n        for validated field\n    :type possible_values: function\n    '''\n    def validate(key, data, errors, context):\n        if not data[key] in list_possible_values():\n            raise Invalid('\"{0}\" is not a valid parameter'.format(data[key]))\n    return validate\n\n\ndef datastore_fields(resource, valid_field_types):\n    '''\n    Return a list of all datastore fields for a given resource, as long as\n    the datastore field type is in valid_field_types.\n\n    :param resource: resource dict\n    :type resource: dict\n    :param valid_field_types: field types to include in returned list\n    :type valid_field_types: list of strings\n    '''\n    data = {'resource_id': resource['id'], 'limit': 0}\n    fields = toolkit.get_action('datastore_search')({}, data)['fields']\n    return [{'value': f['id'], 'text': f['id']} for f in fields\n            if f['type'] in valid_field_types]\n\n\nclass ReclineViewBase(p.SingletonPlugin):\n    '''\n    This base class for the Recline view extensions.\n    '''\n    p.implements(p.IConfigurer, inherit=True)\n    p.implements(p.IResourceView, inherit=True)\n    p.implements(p.ITemplateHelpers, inherit=True)\n\n    def update_config(self, config):\n        '''\n        Set up the resource library, public directory and\n        template directory for the view\n        '''\n        toolkit.add_public_directory(config, 'theme/public')\n        toolkit.add_template_directory(config, 'theme/templates')\n        toolkit.add_resource('theme/public', 'ckanext-reclineview')\n\n    def can_view(self, data_dict):\n        resource = data_dict['resource']\n        return (resource.get('datastore_active') or\n                '_datastore_only_resource' in resource.get('url', ''))\n\n    def setup_template_variables(self, context, data_dict):\n        return {'resource_json': json.dumps(data_dict['resource']),\n                'resource_view_json': json.dumps(data_dict['resource_view'])}\n\n    def view_template(self, context, data_dict):\n        return 'recline_view.html'\n\n    def get_helpers(self):\n        return {\n            'get_map_config': get_mapview_config,\n            'get_dataproxy_url': get_dataproxy_url,\n        }\n\n\nclass ReclineView(ReclineViewBase):\n    '''\n    This extension views resources using a Recline MultiView.\n    '''\n\n    def info(self):\n        return {'name': 'recline_view',\n                'title': 'Data Explorer',\n                'filterable': True,\n                'icon': 'table',\n                'requires_datastore': False,\n                'default_title': p.toolkit._('Data Explorer'),\n                }\n\n    def can_view(self, data_dict):\n        resource = data_dict['resource']\n\n        if (resource.get('datastore_active') or\n                '_datastore_only_resource' in resource.get('url', '')):\n            return True\n        resource_format = resource.get('format', None)\n        if resource_format:\n            return resource_format.lower() in ['csv', 'xls', 'xlsx', 'tsv']\n        else:\n            return False\n\n\nclass ReclineGridView(ReclineViewBase):\n    '''\n    This extension views resources using a Recline grid.\n    '''\n\n    def info(self):\n        return {'name': 'recline_grid_view',\n                'title': 'Grid',\n                'filterable': True,\n                'icon': 'table',\n                'requires_datastore': True,\n                'default_title': p.toolkit._('Table'),\n                }\n\n\nclass ReclineGraphView(ReclineViewBase):\n    '''\n    This extension views resources using a Recline graph.\n    '''\n\n    graph_types = [{'value': 'lines-and-points',\n                    'text': 'Lines and points'},\n                   {'value': 'lines', 'text': 'Lines'},\n                   {'value': 'points', 'text': 'Points'},\n                   {'value': 'bars', 'text': 'Bars'},\n                   {'value': 'columns', 'text': 'Columns'}]\n\n    datastore_fields = []\n\n    datastore_field_types = ['numeric', 'int4', 'timestamp']\n\n    def list_graph_types(self):\n        return [t['value'] for t in self.graph_types]\n\n    def list_datastore_fields(self):\n        return [t['value'] for t in self.datastore_fields]\n\n    def info(self):\n        # in_list validator here is passed functions because this\n        # method does not know what the possible values of the\n        # datastore fields are (requires a datastore search)\n        schema = {\n            'offset': [ignore_empty, natural_number_validator],\n            'limit': [ignore_empty, natural_number_validator],\n            'graph_type': [ignore_empty, in_list(self.list_graph_types)],\n            'group': [ignore_empty, in_list(self.list_datastore_fields)],\n            'series': [ignore_empty, in_list(self.list_datastore_fields)]\n        }\n        return {'name': 'recline_graph_view',\n                'title': 'Graph',\n                'filterable': True,\n                'icon': 'bar-chart-o',\n                'requires_datastore': True,\n                'schema': schema,\n                'default_title': p.toolkit._('Graph'),\n                }\n\n    def setup_template_variables(self, context, data_dict):\n        self.datastore_fields = datastore_fields(data_dict['resource'],\n                                                 self.datastore_field_types)\n        vars = ReclineViewBase.setup_template_variables(self, context,\n                                                        data_dict)\n        vars.update({'graph_types': self.graph_types,\n                     'graph_fields': self.datastore_fields})\n        return vars\n\n    def form_template(self, context, data_dict):\n        return 'recline_graph_form.html'\n\n\nclass ReclineMapView(ReclineViewBase):\n    '''\n    This extension views resources using a Recline map.\n    '''\n\n    map_field_types = [{'value': 'lat_long',\n                        'text': 'Latitude / Longitude fields'},\n                       {'value': 'geojson', 'text': 'GeoJSON'}]\n\n    datastore_fields = []\n\n    datastore_field_latlon_types = ['numeric']\n\n    datastore_field_geojson_types = ['text']\n\n    def list_map_field_types(self):\n        return [t['value'] for t in self.map_field_types]\n\n    def list_datastore_fields(self):\n        return [t['value'] for t in self.datastore_fields]\n\n    def info(self):\n        # in_list validator here is passed functions because this\n        # method does not know what the possible values of the\n        # datastore fields are (requires a datastore search)\n        schema = {\n            'offset': [ignore_empty, natural_number_validator],\n            'limit': [ignore_empty, natural_number_validator],\n            'map_field_type': [ignore_empty,\n                               in_list(self.list_map_field_types)],\n            'latitude_field': [ignore_empty,\n                               in_list(self.list_datastore_fields)],\n            'longitude_field': [ignore_empty,\n                                in_list(self.list_datastore_fields)],\n            'geojson_field': [ignore_empty,\n                              in_list(self.list_datastore_fields)],\n            'auto_zoom': [ignore_empty],\n            'cluster_markers': [ignore_empty]\n        }\n        return {'name': 'recline_map_view',\n                'title': 'Map',\n                'schema': schema,\n                'filterable': True,\n                'icon': 'map-marker',\n                'default_title': p.toolkit._('Map'),\n                }\n\n    def setup_template_variables(self, context, data_dict):\n        map_latlon_fields = datastore_fields(\n            data_dict['resource'], self.datastore_field_latlon_types)\n        map_geojson_fields = datastore_fields(\n            data_dict['resource'], self.datastore_field_geojson_types)\n\n        self.datastore_fields = map_latlon_fields + map_geojson_fields\n\n        vars = ReclineViewBase.setup_template_variables(self, context,\n                                                        data_dict)\n        vars.update({'map_field_types': self.map_field_types,\n                     'map_latlon_fields': map_latlon_fields,\n                     'map_geojson_fields': map_geojson_fields\n                     })\n        return vars\n\n    def form_template(self, context, data_dict):\n        return 'recline_map_form.html'\n", "path": "ckanext/reclineview/plugin.py"}]}