Browse Source

[#45] Changed the return of the hash methods, we get integer instead of string

Roland Haroutiounian 9 years ago
parent
commit
0bf24b6c48
2 changed files with 2 additions and 2 deletions
  1. 1
    1
      EditorialModel/components.py
  2. 1
    1
      EditorialModel/model.py

+ 1
- 1
EditorialModel/components.py View File

@@ -83,7 +83,7 @@ class EmComponent(object):
83 83
     ## @brief Hash function that allows to compare two EmComponent
84 84
     # @return EmComponent+ClassName+uid
85 85
     def __hash__(self):
86
-        return hashlib.md5(str(self.attr_dump).encode('utf-8')).hexdigest()
86
+        return int(hashlib.md5(str(self.attr_dump).encode('utf-8')).hexdigest(),16)
87 87
 
88 88
     ## @brief Test if two EmComponent are "equals"
89 89
     # @return True or False

+ 1
- 1
EditorialModel/model.py View File

@@ -27,7 +27,7 @@ class Model(object):
27 27
         self.load()
28 28
 
29 29
     def __hash__(self):
30
-        return hashlib.md5(str({uid: component.__hash__ for uid, component in self._components.items()}).encode('utf-8')).hexdigest()
30
+        return int(hashlib.md5(str({uid: component.__hash__ for uid, component in self._components.items()}).encode('utf-8')).hexdigest(),16)
31 31
 
32 32
     def __eq__(self, other):
33 33
         return self.__hash__() == other.__hash__()

Loading…
Cancel
Save