[ckan-changes] [okfn/ckan] 61aacc: [#362][s]: remove controller, routing and test cod...

GitHub noreply at github.com
Wed Feb 20 16:14:24 UTC 2013


  Branch: refs/heads/master
  Home:   https://github.com/okfn/ckan
  Commit: 61aacc8f106b13e65f48a1759e9aded019359555
      https://github.com/okfn/ckan/commit/61aacc8f106b13e65f48a1759e9aded019359555
  Author: Rufus Pollock <rufus.pollock at okfn.org>
  Date:   2013-02-15 (Fri, 15 Feb 2013)

  Changed paths:
    M ckan/config/routing.py
    R ckan/controllers/datastore.py
    R ckan/tests/functional/test_datastore.py

  Log Message:
  -----------
  [#362][s]: remove controller, routing and test code related to old (ES) datastore.

Note, have not removed (and will not remove) references to old datastore in:

* templates_legacy (assume these will get removed anyway)
* i18n (assume this will get rebuilt prior to release)


  Commit: 27361b88e1b8fe2167f83bd9cb5cf70e953ce052
      https://github.com/okfn/ckan/commit/27361b88e1b8fe2167f83bd9cb5cf70e953ce052
  Author: Rufus Pollock <rufus.pollock at okfn.org>
  Date:   2013-02-15 (Fri, 15 Feb 2013)

  Changed paths:
    M ckan/controllers/package.py
    R ckan/templates/package/resource_api_data.html
    M ckan/templates/package/snippets/data_api_button.html

  Log Message:
  -----------
  [#362,bugfix][s]: remove remaining reference to routing for old datastore (by removing api_data method in package controller).

The ultimate change was reasonably substantial - removal of an entire method on
a controller and associated template. It began simply with the need to
remove/update reference this routing call in api_data method on package
controller

    url = h.url_for('datastore_read', id=id, qualified=True)

I spent about half an hour trying to understand if this method was used at all.

I ultimately determined that we had a setup where clicking on the Data API
button in the resource view had 2 possible effect routes:

* Via href={url} => package.py/api_data method =>
  template/package/resource_api_data.html =>
  template/ajax_snippets/api_info.html
* Via JS intercept of click => api/snippets controller =>
  template/ajax_snippets/api_info.html

But there was a subtle difference: the first route (which is *not* normally
followed since JS is usally enabled) still uses the old datastore URL (this is
why I'd started this investigation!).

(Aside: this was hard to debug through the interface as JS is enabled and I
note we do not have resource view tests so the non AJAX route is not tested).

I first tried to correct this by setting the URL to the correct datastore API
but then discovered other parameters were missing - it seems the signature of
the call to ajax_snippets template has changed but that the relevant code in
package/resource_data_api.html has not been updated:

    {% snippet 'ajax_snippets/api_info.html', datastore_root_url=datastore_root_url, embedded=true %}

Rather than continue fixing I decided at this point to remove this non-AJAX
fallback code in its entirety.

Comment: this was a subtle bug that has crept in because there are now 2 ways to do
something and one of these routes (the non-AJAX route) is almost never used ...

I wonder whether it is necessary always to have both options (AJAX and
non-AJAX) as it likely to multiply code complexity and, hence, these sort of bugs.


  Commit: e8eb4ad76b0d016d5d8c6431098376fc33507504
      https://github.com/okfn/ckan/commit/e8eb4ad76b0d016d5d8c6431098376fc33507504
  Author: tobes <toby.junk at gmail.com>
  Date:   2013-02-18 (Mon, 18 Feb 2013)

  Changed paths:
    M ckan/templates/package/snippets/data_api_button.html

  Log Message:
  -----------
  [#362] Fix api info for non-js browsing


  Commit: 0fe757949f244ab935e49c619f2603e16659e29b
      https://github.com/okfn/ckan/commit/0fe757949f244ab935e49c619f2603e16659e29b
  Author: tobes <toby.junk at gmail.com>
  Date:   2013-02-18 (Mon, 18 Feb 2013)

  Changed paths:
    M ckan/templates/package/snippets/data_api_button.html

  Log Message:
  -----------
  [#362] Fix broken test code


  Commit: de894c0ea8e1c5ad0a23b7150760296bd57c15a1
      https://github.com/okfn/ckan/commit/de894c0ea8e1c5ad0a23b7150760296bd57c15a1
  Author: amercader <amercadero at gmail.com>
  Date:   2013-02-20 (Wed, 20 Feb 2013)

  Changed paths:
    M ckan/templates/package/snippets/data_api_button.html

  Log Message:
  -----------
  [#362] Fix datastore active check and misleading message


  Commit: 032c779d3c1455ba34603999445b3d26afebd5dd
      https://github.com/okfn/ckan/commit/032c779d3c1455ba34603999445b3d26afebd5dd
  Author: amercader <amercadero at gmail.com>
  Date:   2013-02-20 (Wed, 20 Feb 2013)

  Changed paths:
    M ckan/config/routing.py
    R ckan/controllers/datastore.py
    M ckan/controllers/package.py
    R ckan/templates/package/resource_api_data.html
    M ckan/templates/package/snippets/data_api_button.html
    R ckan/tests/functional/test_datastore.py

  Log Message:
  -----------
  Merge branch '362-remove-old-datastore'

Conflicts:
	ckan/templates/package/snippets/data_api_button.html


  Commit: f8089c9598ff26f07b05eb7a24faf75175f333db
      https://github.com/okfn/ckan/commit/f8089c9598ff26f07b05eb7a24faf75175f333db
  Author: amercader <amercadero at gmail.com>
  Date:   2013-02-20 (Wed, 20 Feb 2013)

  Changed paths:
    M ckan/controllers/admin.py
    R ckan/templates/admin/authz.html
    M ckan/templates/admin/snippets/header.html

  Log Message:
  -----------
  Merge branch 'master' of github.com:okfn/ckan


Compare: https://github.com/okfn/ckan/compare/5aab872c4925...f8089c9598ff


More information about the ckan-changes mailing list