From b17407360c6525d0ccd0c3cdcc5b4a4004babe54 Mon Sep 17 00:00:00 2001
From: Philip Abbet <philip.abbet@idiap.ch>
Date: Fri, 17 Mar 2017 11:33:39 +0100
Subject: [PATCH] More fixes

---
 beat/backend/python/hash.py  |  4 ++++
 beat/backend/python/utils.py | 11 +++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/beat/backend/python/hash.py b/beat/backend/python/hash.py
index 7b7b815..0ce1749 100644
--- a/beat/backend/python/hash.py
+++ b/beat/backend/python/hash.py
@@ -30,6 +30,10 @@
 
 
 import hashlib
+import simplejson
+import collections
+import copy
+import six
 
 
 def _sha256(s):
diff --git a/beat/backend/python/utils.py b/beat/backend/python/utils.py
index 4dd78ca..31e5cb8 100644
--- a/beat/backend/python/utils.py
+++ b/beat/backend/python/utils.py
@@ -253,7 +253,13 @@ class CodeStorage(object):
 
   def save(self, declaration, code=None, description=None):
     """Saves the JSON declaration and the code as files"""
-    super(CodeStorage, self).save(declaration, description)
+    if description:
+      self.doc.save(description.encode('utf8'))
+
+    if not isinstance(declaration, six.string_types):
+      declaration = simplejson.dumps(declaration, indent=4)
+    self.json.save(declaration)
+
     if code:
       if self._language == 'unknown':
         self.language = self.__auto_discover_language(declaration)
@@ -261,5 +267,6 @@ class CodeStorage(object):
 
   def remove(self):
     """Removes the object from the disk"""
-    super(CodeStorage, self).remove()
+    self.json.remove()
+    self.doc.remove()
     self.code.remove()
-- 
GitLab