[ckan-dev] group extras bug

Sean Hammond sean.hammond at okfn.org
Fri Aug 24 10:23:42 UTC 2012


> I'm pretty sure I've found a bug which is at the root of problems with
> the group edit form. This is in CKAN 1.7.1 and I think it affects
> master too. The form loses data from custom fields (that are stored as
> extras) when you submit and there is a validation error. There are no
> such fields in thedatahub, but I think there are in ecportal, so could
> be worth your time getting this into 1.8.
> 
> A patch for CKAN is below. There is still a small problem in that 9
> tests fail now that the 'display_name' can't be found when rendering
> the group (introduced in group_list_dictize but group_show now returns
> the result of validation() which is where it is lost again) and I'm
> not sure how best that should be fixed.
> 
> I've just checked in some tests for DGU that show the issue in the
> form, so you could base some core CKAN tests on these, and something
> like the DGU publisher edit form & schema.
> https://github.com/datagovuk/ckanext-dgu/commit/aa12cacb11fedcdf4816e7cf795d37f7bac88563
> 
> Dave
> 
> diff --git a/ckan/logic/action/get.py b/ckan/logic/action/get.py
> index 7ee7438..b3fa78c 100644
> --- a/ckan/logic/action/get.py
> +++ b/ckan/logic/action/get.py
> @@ -550,7 +550,7 @@ def group_show(context, data_dict):
>          schema = group_plugin.db_to_form_schema()
> 
>      if schema:
> -        package_dict, errors = validate(group_dict, schema, context=context)
> +        group_dict, errors = validate(group_dict, schema, context=context)
> 
>      return group_dict

Thanks David, I think this was fixed in master and 1.8 a while ago




More information about the ckan-dev mailing list