[ckan-dev] allow_partial_updates - issues with demo site - where should we be going?

Toby Dacre toby.okfn at gmail.com
Fri Jul 13 15:56:30 UTC 2012


I've created a branch to fix this behaviour when a config option is set

https://github.com/okfn/ckan/pull/67

On 13 July 2012 11:24, Toby Dacre <toby.okfn at gmail.com> wrote:

>
>
> On 13 July 2012 11:11, Sean Hammond <sean.hammond at okfn.org> wrote:
>
>> > With the demo site we are using package_update action
>> >
>> > we are using allow_partial_updates when we are doing the updates - this
>> is
>> > great for things like not loosing all our resources when we update a
>> > package however it also means that we cannot for example remove all our
>> > tags as an empty tags is seen as non-existent and so the tags are not
>> > updated
>> >
>> > What I would prefer is that tags is in pkg_dict we would update it but
>> if
>> > it wasn't we wouldn't
>>
>> Yes I agree, for everything in dictionaries. It's a PITA to have to pass
>> the entire dict back to the CKAN API to avoid it deleting random bits
>> that you're not interested in. If I just want to change a package's
>> tags, for example, I should just be able to call package_update passing
>> only the package ID and the tags, and this should not cause the
>> package's resources (for example) to get deleted.
>>
>> > the problem with this is that form data is validated and an empty tag is
>> > removed from that data - then when we are in the update missing tag data
>> > ends up becoming [ ]
>>
>> You mean that if the dict that I pass to package_update has no 'tags'
>> key at all, then this deletes all the package's tags? I agree this
>> shouldn't change the package's tags at all, but it sounds like you're
>> going to have to modify the validate code to fix that, and that could be
>> hairy.
>>
>> The other thing is, you would be changing the behaviour of the API (all
>> the *_update functions I think) so you might break clients.
>>
>
> How about a config option to change the behaviour?  I'll start by doing a
> branch and seeing if all the tests still pass that would be a good sign of
> things - if some fail then I think the config option would seem a way
> forward.  This isn't going to happen till 1.9 if it is accepted.
>
>
>>
>> > It seems to me that tags = [ ] should not be seen as empty by validation
>> > whereas no tags in the data should be
>>
>> Don't you have this backwards? tags=[] in the data _should_ be seen as
>> me trying to remove all of the package's tags, no 'tags' key in the data
>> should mean don't make any change to the package's tags.
>>
>
> Sorry my language may be a bit confused. I mean is that if I pass [ ] to
> the validation it thinks I've passed nothing and so removes it and then
> later in the process the lack of something then gets changed to [ ].
>
> What should happen is that [ ] does not get killed by the validation and a
> missing value does not get converted to [ ]
>
>>
>> > then when processing the update we should not convert None -> [ ]
>>
>> Yes
>>
>> Thanks for the feedback
>
>
>> > The other option would be for me to add a more modular
>> > allow_partial_updates which would allow the items to be updated/or not
>> to
>> > be more granularly controlled but this would become messy and the code
>> > would look shitty
>>
>> Yes this sounds complicated
>>
>>
> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20120713/82a76844/attachment-0001.html>


More information about the ckan-dev mailing list