From 16dc43e7fd45156dc2d60450674643f141da9fd4 Mon Sep 17 00:00:00 2001 From: Marko Bocevski Date: Wed, 14 Oct 2020 11:03:37 +0200 Subject: [PATCH] Add dictization_functions unflatten patch --- .../01_dictization_functions_unflatten.patch | 32 +++++++++++++++++++ .../01_dictization_functions_unflatten.patch | 32 +++++++++++++++++++ .../01_dictization_functions_unflatten.patch | 32 +++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 images/ckan/2.7/patches/01_dictization_functions_unflatten.patch create mode 100644 images/ckan/2.8/patches/01_dictization_functions_unflatten.patch create mode 100644 images/ckan/2.9/patches/01_dictization_functions_unflatten.patch diff --git a/images/ckan/2.7/patches/01_dictization_functions_unflatten.patch b/images/ckan/2.7/patches/01_dictization_functions_unflatten.patch new file mode 100644 index 0000000..51258cd --- /dev/null +++ b/images/ckan/2.7/patches/01_dictization_functions_unflatten.patch @@ -0,0 +1,32 @@ +--- ckan/ckan/lib/navl/dictization_functions.py 2020-10-14 10:48:40.146291362 +0200 ++++ dictization_functions_unflatten_patch.py 2020-10-14 10:48:29.979771608 +0200 +@@ -440,19 +440,24 @@ + for flattend_key in sorted(data.keys(), key=flattened_order_key): + current_pos = unflattened + ++ if (len(flattend_key) > 1 ++ and not flattend_key[0] in convert_to_list ++ and not flattend_key[0] in unflattened): ++ convert_to_list.append(flattend_key[0]) ++ + for key in flattend_key[:-1]: + try: + current_pos = current_pos[key] +- except IndexError: +- new_pos = {} +- current_pos.append(new_pos) +- current_pos = new_pos + except KeyError: +- new_pos = [] ++ new_pos = {} + current_pos[key] = new_pos + current_pos = new_pos + current_pos[flattend_key[-1]] = data[flattend_key] + ++ for key in convert_to_list: ++ unflattened[key] = [unflattened[key][s] ++ for s in sorted(unflattened[key])] ++ + return unflattened + + diff --git a/images/ckan/2.8/patches/01_dictization_functions_unflatten.patch b/images/ckan/2.8/patches/01_dictization_functions_unflatten.patch new file mode 100644 index 0000000..573cffd --- /dev/null +++ b/images/ckan/2.8/patches/01_dictization_functions_unflatten.patch @@ -0,0 +1,32 @@ +--- ckan/ckan/lib/navl/dictization_functions.py 2020-10-14 10:39:46.319132692 +0200 ++++ dictization_functions_unflatten_patch.py 2020-10-14 10:40:38.204657981 +0200 +@@ -442,19 +442,24 @@ + for flattend_key in sorted(data.keys(), key=flattened_order_key): + current_pos = unflattened + ++ if (len(flattend_key) > 1 ++ and not flattend_key[0] in convert_to_list ++ and not flattend_key[0] in unflattened): ++ convert_to_list.append(flattend_key[0]) ++ + for key in flattend_key[:-1]: + try: + current_pos = current_pos[key] +- except IndexError: +- new_pos = {} +- current_pos.append(new_pos) +- current_pos = new_pos + except KeyError: +- new_pos = [] ++ new_pos = {} + current_pos[key] = new_pos + current_pos = new_pos + current_pos[flattend_key[-1]] = data[flattend_key] + ++ for key in convert_to_list: ++ unflattened[key] = [unflattened[key][s] ++ for s in sorted(unflattened[key])] ++ + return unflattened + + diff --git a/images/ckan/2.9/patches/01_dictization_functions_unflatten.patch b/images/ckan/2.9/patches/01_dictization_functions_unflatten.patch new file mode 100644 index 0000000..c4acfc3 --- /dev/null +++ b/images/ckan/2.9/patches/01_dictization_functions_unflatten.patch @@ -0,0 +1,32 @@ +--- ckan/ckan/lib/navl/dictization_functions.py 2020-10-14 10:45:07.519582188 +0200 ++++ dictization_functions_unflatten_patch.py 2020-10-14 10:46:26.258305671 +0200 +@@ -410,19 +410,24 @@ + for flattend_key in sorted(data.keys(), key=flattened_order_key): + current_pos = unflattened + ++ if (len(flattend_key) > 1 ++ and not flattend_key[0] in convert_to_list ++ and not flattend_key[0] in unflattened): ++ convert_to_list.append(flattend_key[0]) ++ + for key in flattend_key[:-1]: + try: + current_pos = current_pos[key] +- except IndexError: +- new_pos = {} +- current_pos.append(new_pos) +- current_pos = new_pos + except KeyError: +- new_pos = [] ++ new_pos = {} + current_pos[key] = new_pos + current_pos = new_pos + current_pos[flattend_key[-1]] = data[flattend_key] + ++ for key in convert_to_list: ++ unflattened[key] = [unflattened[key][s] ++ for s in sorted(unflattened[key])] ++ + return unflattened + +