Skip to content

Commit

Permalink
Identity From and to Json #178
Browse files Browse the repository at this point in the history
  • Loading branch information
Insoleet committed Jul 14, 2015
1 parent a8e130a commit f88e4b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/cutecoin/core/registry/identities.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ def from_handled_data(self, uid, pubkey, blockchain_state):
self._instances[pubkey].blockchain_state = blockchain_state
elif self._instances[pubkey].blockchain_state != BlockchainState.VALIDATED \
and blockchain_state == BlockchainState.VALIDATED:
self._instance[pubkey].blockchain_state = blockchain_state
self._instances[pubkey].inner_data_changed.emit()
self._instances[pubkey].blockchain_state = blockchain_state
self._instances[pubkey].inner_data_changed.emit("")

if self._instances[pubkey].uid != uid:
self._instances[pubkey].uid = uid
self._instances[pubkey].inner_data_changed.emit()
self._instances[pubkey].inner_data_changed.emit("")

if self._instances[pubkey].local_state == LocalState.NOT_FOUND:
self._instances[pubkey].local_state = LocalState.COMPLETED
Expand Down
8 changes: 4 additions & 4 deletions src/cutecoin/core/registry/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def from_json(cls, json_data):
"""
pubkey = json_data['pubkey']
uid = json_data['uid']
local_state = json_data['local_state']
blockchain_state = json_data['blockchain_state']
local_state = LocalState[json_data['local_state']]
blockchain_state = BlockchainState[json_data['blockchain_state']]

return cls(uid, pubkey, local_state, blockchain_state)

Expand Down Expand Up @@ -325,8 +325,8 @@ def jsonify(self):
"""
data = {'uid': self.uid,
'pubkey': self.pubkey,
'local_state': self.local_state,
'blockchain_state': self.blockchain_state}
'local_state': self.local_state.name,
'blockchain_state': self.blockchain_state.name}
return data

def __str__(self):
Expand Down

0 comments on commit f88e4b8

Please sign in to comment.