fix wim persistence issue
[osm/RO.git] / RO / osm_ro / wim / persistence.py
index 32a46b3..27a87c4 100644 (file)
@@ -40,6 +40,7 @@ No domain logic/architectural concern should be present in this file.
 """
 import json
 import logging
+import string
 from contextlib import contextmanager
 from hashlib import sha1
 from itertools import groupby
@@ -307,6 +308,11 @@ class WimPersistence(object):
         if "config" in wim_descriptor:
             wim_descriptor["config"] = _serialize(wim_descriptor["config"])
 
+        url = wim_descriptor["wim_url"]
+        wim_descriptor["wim_url"] = url.strip(string.whitespace + "/")
+        # ^  This avoid the common problem caused by trailing spaces/slashes in
+        #    the URL (due to CTRL+C/CTRL+V)
+
         return self.db.new_row(
             "wims", wim_descriptor, add_uuid=True, confidential_data=True)
 
@@ -864,10 +870,7 @@ def _preprocess_wim_account(wim_account):
     """
     wim_account = preprocess_record(wim_account)
 
-    created = wim_account.get('created')
-    wim_account['created'] = (
-        'true' if created is True or created == 'true' else 'false')
-
+    wim_account['sdn'] = False
     return wim_account