AppGeo / ckanext-agsview

MIT License
10 stars 10 forks source link

Support for *non* proxy sites #10

Open hamhands opened 7 years ago

hamhands commented 7 years ago

We are not running proxies and agsview has been returning an internal server error for the services we're working with. Logs below:

[Thu Aug 17 17:46:37.620186 2017] [:error] [pid 17045:tid 140527971874560] [remote 127.0.0.1:42818] data-module-path="{{ h.with_proxy(resource_view.get('ags_url') or resource.url) }}"
[Thu Aug 17 17:46:37.620188 2017] [:error] [pid 17045:tid 140527971874560] [remote 127.0.0.1:42818] File '/usr/lib/ckan/default/src/ckanext-agsview/ckanext/agsview/plugin.py', line 31 in w$
[Thu Aug 17 17:46:37.620190 2017] [:error] [pid 17045:tid 140527971874560] [remote 127.0.0.1:42818] proxies = json.loads(ags_view_proxy())
[Thu Aug 17 17:46:37.620192 2017] [:error] [pid 17045:tid 140527971874560] [remote 127.0.0.1:42818] File '/usr/lib/python2.7/json/init.py', line 338 in loads
[Thu Aug 17 17:46:37.620194 2017] [:error] [pid 17045:tid 140527971874560] [remote 127.0.0.1:42818] return _default_decoder.decode(s)
[Thu Aug 17 17:46:37.620195 2017] [:error] [pid 17045:tid 140527971874560] [remote 127.0.0.1:42818] File '/usr/lib/python2.7/json/decoder.py', line 366 in decode
[Thu Aug 17 17:46:37.620197 2017] [:error] [pid 17045:tid 140527971874560] [remote 127.0.0.1:42818] obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[Thu Aug 17 17:46:37.620199 2017] [:error] [pid 17045:tid 140527971874560] [remote 127.0.0.1:42818] File '/usr/lib/python2.7/json/decoder.py', line 385 in raw_decode
[Thu Aug 17 17:46:37.620201 2017] [:error] [pid 17045:tid 140527971874560] [remote 127.0.0.1:42818] raise ValueError("No JSON object could be decoded")
[Thu Aug 17 17:46:37.620203 2017] [:error] [pid 17045:tid 140527971874560] [remote 127.0.0.1:42818] ValueError: No JSON object could be decoded

Rolled back to ac26b9ee99a1de1e002dacee3fad4b6b61b26d29 and now the plugin works. Are proxies required or is this a bug?

calvinmetcalf commented 7 years ago

@GuidoS I think this line might need to be wrapped in a try/catch or whatever they pythonic version of that is