Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the function is documented as taking a list of dicts, it's possibly not the right thing to do, to just silently ignore the bad data passed in. Perhaps if you raise an error that points out that it has been passed bad data (e.g. not a list of dicts) may help in tracking down the real cause of the problem (possibly in a schema somewhere?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ross Jones wrote:
I agree this is not the right thing to do (just did not read the
docstring :P). I can debug this live if you point me to something to
look for. The full traceback does not look very helpful from my point of
view...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that the
package.resources
object passed todict_list_reduce
is actually not alist
but adict
(corresponding to one resource). But the package at stake actually has two resources.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~~I think the thing to investigate is why when calling
dict_list_reduce
withh.dict_list_reduce(package.resources, 'format')
we get things that are not resource dicts. package.resources should definitely be a list of dicts.
Perhaps just dumping
{{package.resources}}
in the package_item template might show what it is being passed, I can only imagine that a plugin/custom-schema is interfering somehow.~~There's definitely some schema weirdness going on. Do you have a custom plugin? Which plugins do you use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm using ckanext-dcat and this dataset comes from a DCAT harvest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package.resources
is just one dict which looks like:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird, perhaps @amercader might know if this is a dcat extension specific weirdness.
As a temporary workaround, you can probably get away with (obviously untested)..
but it should only be a temporary workaround.