From b6dbafee44cd3623484af3e4f93b0c8b190d8fa5 Mon Sep 17 00:00:00 2001 From: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com> Date: Wed, 19 Oct 2022 16:17:14 +0200 Subject: [PATCH] Fix map cloning (#1252) (#1253) * Fix map cloning * Fix map cloning --- geonode_mapstore_client/migrations/0002_migrate_map_blob.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/geonode_mapstore_client/migrations/0002_migrate_map_blob.py b/geonode_mapstore_client/migrations/0002_migrate_map_blob.py index 3f158ffeb8..00b01b5d61 100644 --- a/geonode_mapstore_client/migrations/0002_migrate_map_blob.py +++ b/geonode_mapstore_client/migrations/0002_migrate_map_blob.py @@ -1,6 +1,7 @@ # Generated by Django 3.2.13 on 2022-04-28 07:32 import ast import base64 +import json from django.db import migrations, connections @@ -35,7 +36,10 @@ def migrate_map_forward(apps, schema_editor): cursor.execute(sql_string) result = cursor.fetchall() if result: - to_update['blob'] = result[0][0] + try: + to_update['blob'] = json.loads(result[0][0]) + except Exception as e: + to_update['blob'] = result[0][0] sql_string = f'SELECT name, value from mapstore2_adapter_mapstoreattribute where resource_id={_resource.id};' '''