[ckan-changes] [okfn/ckan] 3f0193: Merge branch 'idatasetform-fixes' into idatasetfor...

GitHub noreply at github.com
Thu Mar 21 13:36:08 UTC 2013


  Branch: refs/heads/idatasetform-fixes-branched-off-release-v2.0
  Home:   https://github.com/okfn/ckan
  Commit: 3f01930906ede4a18f5ddf3bdf69e0380b76f668
      https://github.com/okfn/ckan/commit/3f01930906ede4a18f5ddf3bdf69e0380b76f668
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/controllers/package.py
    M ckan/logic/schema.py

  Log Message:
  -----------
  Merge branch 'idatasetform-fixes' into idatasetform-fixes-branched-off-release-v2.0

Conflicts:
	ckan/controllers/package.py
	ckan/lib/plugins.py
	ckan/logic/schema.py


  Commit: 3031790a61bf4915062dca9691f8b487f9836d0a
      https://github.com/okfn/ckan/commit/3031790a61bf4915062dca9691f8b487f9836d0a
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    A ckanext/example_idatasetform/__init__.py
    A ckanext/example_idatasetform/plugin.py
    A ckanext/example_idatasetform/templates/package/new_package_metadata.html
    A ckanext/example_idatasetform/templates/package/read.html
    A ckanext/example_idatasetform/templates/package/snippets/package_form.html
    A ckanext/example_idatasetform/templates/package/snippets/package_metadata_fields.html
    A ckanext/example_idatasetform/templates/package/snippets/package_metadata_form.html
    M setup.py

  Log Message:
  -----------
  [#2750] Add ckanext/example_idatasetform


  Commit: 0dfef96bfd002546c70b530c99676ee03ba47cb1
      https://github.com/okfn/ckan/commit/0dfef96bfd002546c70b530c99676ee03ba47cb1
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/lib/plugins.py
    M ckan/plugins/interfaces.py
    M doc/conf.py

  Log Message:
  -----------
  [#2750] Improve IDatasetForm docstrings

- Rewrite the IDatasetForm docstrings to make them clearer,
  and conform to PEP257
- Reorder methods in IDatasetForm and DefaultDatasetForm
  so that they're 1. in a more logical order and 2. in the
  same order as eachother
- Tell autodoc to put the methods in source-code order,
  not alphabetical, in the sphinx docs
- Remove docstrings from DefaultDatasetForm that are
  exact repeats of corresponding docstrings in IDatasetForm
- Add edit_template() to IDatasetForm, it was missing

db_to_form_schema_options() and form_to_db_schema_options() and some
other schema methods in DefaultDatasetForm are still missing from
IDatasetForm but I'm leaving it that way for now, consider them
unofficial.


  Commit: cdfe65dfb83b46508856c8475e61ea462312a796
      https://github.com/okfn/ckan/commit/cdfe65dfb83b46508856c8475e61ea462312a796
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    R doc/forms.rst
    M doc/index.rst

  Log Message:
  -----------
  [#2750] Delete 'Customizing Forms' docs

They are out of date, and we have ckanext/example_idatasetform instead
now.


  Commit: fe06841f28def4783f7ffd5f0d848c3a81bd0698
      https://github.com/okfn/ckan/commit/fe06841f28def4783f7ffd5f0d848c3a81bd0698
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M doc/tag-vocabularies.rst

  Log Message:
  -----------
  [#2750] Rewrite tag vocabularies docs

Change the tag vocabularies docs to refer to the working example in
ckanext/example_idatasetform instead of providing their own detailed
instructions.

Also add some more general explanation at the start about what tag
vocabularies are for/why you might want to use them/what you can do with
them, it was all a bit mysterious.

Remove some false claims from the Properties section, I don't think that
the restricted/free vocabulary types are implemented (they are either
always restricted or always free, can't remember), vocabularies do not
have descriptions.

Conflicts:

	doc/tag-vocabularies.rst


  Commit: 6604a1fe1fa2ed6890b34563a3c647378ae4ff6d
      https://github.com/okfn/ckan/commit/6604a1fe1fa2ed6890b34563a3c647378ae4ff6d
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/controllers/package.py
    M ckan/lib/plugins.py
    M ckan/logic/action/create.py
    M ckan/logic/action/update.py
    M ckan/plugins/interfaces.py
    M ckan/tests/functional/test_package.py
    M ckanext/example_idatasetform/plugin.py

  Log Message:
  -----------
  [#602] Deprecate IDatasetForm's check_data_dict

With the new three-stage dataset creation form in CKAN 2.0
check_data_dict() no longer works as intended. For example,
DefaultDatasetForm's check_data_dict() breaks any IDatasetForm plugins
that are trying to use convert_to_extras() (if they inherit from
DefaultDatasetForm).

Remove the method from IDatasetForm and DefaultDatasetForm, but still
call the method in all the places it would previously have been called
_if_ the active IDatasetForm plugin has the method.

Also remove three tests that seem to be testing check_data_dict()'s
behaviours.

Note that in the existing code, check_data_dict() seems to be called
twice when creating a package, once by the package controller and once
by package_create(), and the two are inconsistent in the number of
params they expect check_data_dict() to take! On updating a package it's
called just once, by package_update(). I have preserved these "legacy"
behaviours.

Also note that IGroupForm and IOrganizationForm still have
check_data_dict() methods, we probably want to get rid of them in the
future as well.


  Commit: 739a131c01fcc76c0568ccdf0fd971dc85226b54
      https://github.com/okfn/ckan/commit/739a131c01fcc76c0568ccdf0fd971dc85226b54
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/plugins/toolkit.py
    M ckanext/example_idatasetform/plugin.py

  Log Message:
  -----------
  [#2750] Add DefaultDatasetForm to plugins toolkit

At DefaultDatasetForm to the plugins toolkit. This means that
IDatasetForm plugins based on DefaultDatasetForm no longer need to
import ckan.lib.plugins.

Also change ExampleIDatasetForm to no longer import ckan.lib.plugins.


  Commit: b98ce9a4bc4538527b6829216340bca3d4c837e3
      https://github.com/okfn/ckan/commit/b98ce9a4bc4538527b6829216340bca3d4c837e3
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckanext/example_idatasetform/plugin.py
    R ckanext/example_idatasetform/templates/package/new_package_metadata.html
    R ckanext/example_idatasetform/templates/package/snippets/package_form.html
    M ckanext/example_idatasetform/templates/package/snippets/package_metadata_fields.html
    R ckanext/example_idatasetform/templates/package/snippets/package_metadata_form.html

  Log Message:
  -----------
  [#2750] Use ITemplateHelpers not setup_template_variables()

In ExampleIDatasetForm use ITemplateHelpers not
setup_template_variables() to pass the list of available country codes
to the template. This greatly reduces the number of templates that need
to be overridden!


  Commit: 935f286cb77c02c7efc0680d88090838fd32773e
      https://github.com/okfn/ckan/commit/935f286cb77c02c7efc0680d88090838fd32773e
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckanext/example_idatasetform/plugin.py

  Log Message:
  -----------
  [#2750] Move create_country_codes() to a better place

Move example_idatasetform's create_country_codes() to a better place.


  Commit: 5f8b48b9f36e9c4ab39ecf6e9e354857d7c5cb09
      https://github.com/okfn/ckan/commit/5f8b48b9f36e9c4ab39ecf6e9e354857d7c5cb09
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckanext/example_idatasetform/plugin.py

  Log Message:
  -----------
  [#2750] Add setup_template_variables() back

Add setup_template_variables() back into ExampleIDatasetFormPlugin, just
counts how many times it gets called, for testing purposes.


  Commit: 0fb9269996da9b70681dbdba05caa0a9397c0f1e
      https://github.com/okfn/ckan/commit/0fb9269996da9b70681dbdba05caa0a9397c0f1e
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckanext/example_idatasetform/plugin.py

  Log Message:
  -----------
  [#2750] Use super()

Seems like the right thing to do


  Commit: 2020054889eddbe9e87b8cadda0081deadf7384e
      https://github.com/okfn/ckan/commit/2020054889eddbe9e87b8cadda0081deadf7384e
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckanext/example_idatasetform/templates/package/read.html

  Log Message:
  -----------
  [#2750] Change an HTML comment into a Jinja comment


  Commit: 034f3ae64d6adf264791fed12fb3db57deaca752
      https://github.com/okfn/ckan/commit/034f3ae64d6adf264791fed12fb3db57deaca752
  Author: John Martin <me at johnmart.in>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/templates/package/snippets/package_metadata_fields.html
    M ckanext/example_idatasetform/templates/package/snippets/package_metadata_fields.html

  Log Message:
  -----------
  [#2750] Tweaks base package_metadata_fields.html and then {% ckan_extends %} from it.


  Commit: afd9672e7acdd844b55b632bed033f96671937db
      https://github.com/okfn/ckan/commit/afd9672e7acdd844b55b632bed033f96671937db
  Author: John Martin <me at johnmart.in>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckanext/example_idatasetform/templates/package/snippets/package_metadata_fields.html

  Log Message:
  -----------
  [#2750] Simplify the template yet more


  Commit: 8e0b14459772ad72d51bf1dabb1346887e3c4881
      https://github.com/okfn/ckan/commit/8e0b14459772ad72d51bf1dabb1346887e3c4881
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckanext/example_idatasetform/templates/package/snippets/package_metadata_fields.html

  Log Message:
  -----------
  [#2750] Add custom_text_field back into example idatasetform templates

This field accidentally got removed from the templates in a previous
commit


  Commit: 3d2a396affc29b4f02092550cc16d7a377b183bf
      https://github.com/okfn/ckan/commit/3d2a396affc29b4f02092550cc16d7a377b183bf
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckanext/example_idatasetform/templates/package/snippets/package_metadata_fields.html

  Log Message:
  -----------
  [#2750] Remove 'free extras' from package form in example idatasetform

This is necessary to make convert_to/from_extras() work


  Commit: 23b9a8b510dcb8651cdf4b6875a9c5a102ae9e84
      https://github.com/okfn/ckan/commit/23b9a8b510dcb8651cdf4b6875a9c5a102ae9e84
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/logic/schema.py
    M ckan/tests/lib/test_dictization_schema.py
    M ckan/tests/schema/test_schema.py
    M ckanext/test_tag_vocab_plugin.py

  Log Message:
  -----------
  [#649] Rename default_package_schema() -> _base_package_schema()

Also add a docstring.

This schema seems to be a base schema for other package schemas to be
based on, and a private helper function of schema.py. It's not used
outside of schema.py apart from by some tests that probably should not
be using it. The new name hopefully makes it clearer what the purpose of
this function is.

Conflicts:

	ckan/tests/lib/test_dictization_schema.py


  Commit: 5f9cceb5daaf2a23e1a6b4df5aa7332be7875af2
      https://github.com/okfn/ckan/commit/5f9cceb5daaf2a23e1a6b4df5aa7332be7875af2
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/logic/schema.py

  Log Message:
  -----------
  [#649] Deprecate package_form_schema() properly

I think package_form_schema() was probably deprecated using a code
comment before we had the Right Way of deprecating things (using the
deprecated decorator).


  Commit: 2b221ed9f5f6fd7f929f3598034921f1438ec167
      https://github.com/okfn/ckan/commit/2b221ed9f5f6fd7f929f3598034921f1438ec167
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/controllers/package.py

  Log Message:
  -----------
  [#649] Don't validate package dicts in package controller

The package_*() action functions handle fetching package schemas and
using them to validate package dicts, no need to also do it in the
package controller!

Conflicts:

	ckan/controllers/package.py


  Commit: 02c70b33ba5ab8be8485f936233411e666d7a9e9
      https://github.com/okfn/ckan/commit/02c70b33ba5ab8be8485f936233411e666d7a9e9
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/logic/action/create.py

  Log Message:
  -----------
  [#649] Delete package_create_validate()

Delete package_create_validate() action function.

This function has no docstring and no tests, and duplicates package dict
validation code in package_create().


  Commit: bf60471d24ea4dfdb20bc91d42830fb0dcf5b948
      https://github.com/okfn/ckan/commit/bf60471d24ea4dfdb20bc91d42830fb0dcf5b948
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/logic/action/update.py

  Log Message:
  -----------
  [#649] Delete package_update_validate()

Delete package_update_validate() action function.

This function has no docstring and no tests, and duplicates package dict
validation code in package_update().


  Commit: 738551af03e2275d6296fafa2e8afef60b20dc0e
      https://github.com/okfn/ckan/commit/738551af03e2275d6296fafa2e8afef60b20dc0e
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/lib/plugins.py
    M ckan/logic/action/create.py
    M ckan/logic/action/update.py
    M ckan/logic/schema.py
    M ckan/tests/lib/test_dictization_schema.py
    M ckan/tests/schema/test_schema.py
    M ckanext/test_tag_vocab_plugin.py

  Log Message:
  -----------
  [#649] Refactor form_to_db_schema()

Replace form_to_db_schema(), form_to_db_schema_options(),
form_to_db_schema_api_create(), form_to_db_schema_api_update(),
form_to_db_package_schema() with just two schemas: create and update.
Then get the tests passing.

schema.py:

- Delete _base_package_schema()
- Delete already deprecated package_form_schema()
- Delete form_to_db_package_schema()
- Tweak default_create_package_schema() and
  default_update_package_schema() to get tests passing

DefaultDatasetForm:

- Delete form_to_db_schema_options()
- Delete form_to_db_schema()
- Delete form_to_db_schema_api_create()
- Delete form_to_db_schema_api_update()
- Add create_package_schema(), returns None
- Add update_package_schema(), returns None

Note that by deleting form_to_db_schema() and
form_to_db_schema_options(), _api_create() and _api_update(), we're
breaking backwards compatibility with any plugins that were using these.

package_create():
- Don't call form_to_db_schema_options() or form_to_db_schema().
- Instead call the package plugin's create_package_schema(), if that
  doesn't exist or if it returns None then call
  default_create_package_schema() instead

package_update():
- Don't call form_to_db_schema_options() or form_to_db_schema().
- Instead call the package plugin's update_package_schema(), if that
  doesn't exist or if it returns None then call
  default_update_package_schema() instead

Note that by no longer calling the form_to_db_schema_options() or
form_to_db_schema() methods of IDatasetForm plugins, we're breaking
backward compatibility with those plugins.

Note this makes IDatasetForm less flexible - plugins can return
different schemas for creating, updating or showing packages, but they
can no longer return different schemas depending on whether we're using
the API or web UI, or on other parameters from the Pylons context.

test_tag_vocab.py:

- Update MockVocabTagsPlugin to work with the new interface

Also update some other tests.

Conflicts:

	ckan/lib/plugins.py


  Commit: ba32bd30b4def8b9bea864c9796d1309c55287a9
      https://github.com/okfn/ckan/commit/ba32bd30b4def8b9bea864c9796d1309c55287a9
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/lib/plugins.py
    M ckan/logic/schema.py
    M ckanext/test_tag_vocab_plugin.py

  Log Message:
  -----------
  [#649] Rename db_to_form_package_schema() -> default_show_package_schema()

This makes the name consistent with default_create_package_schema() and
default_update_package_schema().

Conflicts:

	ckan/lib/plugins.py


  Commit: 8296dc6cad6a855f51ce53f8754b02161f81f378
      https://github.com/okfn/ckan/commit/8296dc6cad6a855f51ce53f8754b02161f81f378
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/lib/plugins.py
    M ckan/logic/action/get.py
    M ckanext/test_tag_vocab_plugin.py

  Log Message:
  -----------
  [#649] Get rid of form_to_db_schema_options()

package_show(): Don't call an IDatasetForm plugin's
db_to_form_schema_options() or db_to_form_schema() anymore, instead call
package_show_schema(), if the plugin doesn't have that method or if it
returns None then fall back on
ckan.logic.schema.default_package_show_schema(). (Same pattern as for
package_create() and package_update()).

Delete DefaultDatasetForm's db_to_form_schema_options() and
db_to_form_schema(), add show_package_schema() that just returns None,
same as create_package_schema() and update_package_schema().

Conflicts:

	ckan/lib/plugins.py


  Commit: d433adec307ea5963b9a93d13cf520085b8f4a9d
      https://github.com/okfn/ckan/commit/d433adec307ea5963b9a93d13cf520085b8f4a9d
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/controllers/package.py

  Log Message:
  -----------
  Remove unused _check_data_dict() from package controller

This method is never called

Conflicts:

	ckan/controllers/package.py


  Commit: 54578af0a4806b9798f24526e77111e32591ace1
      https://github.com/okfn/ckan/commit/54578af0a4806b9798f24526e77111e32591ace1
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/controllers/package.py

  Log Message:
  -----------
  [#649] Remove schema-related hacks from package controller

These hacks are no longer needed


  Commit: d52697bb965ab668585452afbf22dce156846719
      https://github.com/okfn/ckan/commit/d52697bb965ab668585452afbf22dce156846719
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckanext/example_idatasetform/plugin.py

  Log Message:
  -----------
  [#649] Update example_idatasetform to new IDatasetForm interface

This imports ckan.logic.schema which is bad.


  Commit: a7c0ea2fe9fe775148f375a7311516248cff7440
      https://github.com/okfn/ckan/commit/a7c0ea2fe9fe775148f375a7311516248cff7440
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/lib/plugins.py
    M ckan/logic/action/create.py
    M ckan/logic/action/get.py
    M ckan/logic/action/update.py
    M ckanext/example_idatasetform/plugin.py

  Log Message:
  -----------
  [#649] Make DefaultDatasetForm return default schemas

Make DefaultDatasetForm's create_package_schema(),
update_package_schema() and show_package_schema() methods return
default_create_package_schema(), default_update_package_schema() and
default_show_package_schema() from schema.py.

This makes it easier for plugins as they can just inherit from
DefaultDatasetForm and call super() to get the default schemas, they
don't need to import ckan.logic.schema to get them (or we don't need to
add the default schemas to the plugins toolkit).

This removes the logic, which was repeated in package_create(),
package_update() and package_show(), of getting the schema from the
plugin but if the plugin provided no schema then falling back on the default
one from schema.py. The action functions now simply get the schema from
plugin and always expect the plugin to provide the schema. The default
fallback behaviour is provided by plugins inheriting from
DefaultDatasetForm instead.


  Commit: 9fc89290ece9b66f549b7fb8994779412fb5fb5a
      https://github.com/okfn/ckan/commit/9fc89290ece9b66f549b7fb8994779412fb5fb5a
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/plugins/interfaces.py

  Log Message:
  -----------
  [#649] Update IDatasetForm docs


  Commit: 59666bc09e96adf27c4b5c5db0769e0f5deb027b
      https://github.com/okfn/ckan/commit/59666bc09e96adf27c4b5c5db0769e0f5deb027b
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-03-21 (Thu, 21 Mar 2013)

  Changed paths:
    M ckan/controllers/package.py
    M ckan/logic/schema.py

  Log Message:
  -----------
  Fix merge issues

Fix a couple of issues that slipped in while trying to merge three
IDatasetForm-relared pull requests into
idatasetform-fixes-branched-off-release-v2.0.

This gets the tests passing.


Compare: https://github.com/okfn/ckan/compare/3f01930906ed^...59666bc09e96


More information about the ckan-changes mailing list