From fd5ecd9b50c1cf00efaf1b0e8040e2dd767b728d Mon Sep 17 00:00:00 2001
From: Holger Nahrstaedt <holger@nahrstaedt.de>
Date: Wed, 11 Apr 2018 10:49:33 +0200
Subject: [PATCH] Fix comment

---
 beem/comment.py         | 6 +++---
 beem/vote.py            | 2 +-
 beemapi/steemnoderpc.py | 4 +++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/beem/comment.py b/beem/comment.py
index e5761431..faf4f09d 100644
--- a/beem/comment.py
+++ b/beem/comment.py
@@ -72,7 +72,7 @@ class Comment(BlockchainObject):
                 self[p] = Amount(self.get(p, "0.000 SBD"), steem_instance=self.steem)
 
         # turn json_metadata into python dict
-        self.__metadata_to_dict()
+        self._metadata_to_dict()
         self["tags"] = []
         self['community'] = ''
         if isinstance(self['json_metadata'], dict):
@@ -84,13 +84,13 @@ class Comment(BlockchainObject):
     def _metadata_to_dict(self):
         """turn json_metadata into python dict"""
         meta_str = self.get("json_metadata", "{}")
+        if meta_str == "{}":
+            self['json_metadata'] = meta_str
         if isinstance(meta_str, (string_types, bytes_types, bytearray)):
             try:
                 self['json_metadata'] = json.loads(meta_str)
             except:
                 self['json_metadata'] = {}
-        else:
-            self['json_metadata'] = {}
 
     def refresh(self):
         if self.identifier == "":
diff --git a/beem/vote.py b/beem/vote.py
index 72e88d12..3d30ff2e 100644
--- a/beem/vote.py
+++ b/beem/vote.py
@@ -100,7 +100,7 @@ class Vote(BlockchainObject):
             if x["voter"] == voter:
                 vote = x
         if not vote:
-            raise VoteDoesNotExistsException
+            raise VoteDoesNotExistsException(self.identifier)
         super(Vote, self).__init__(vote, id_item="authorpermvoter", steem_instance=self.steem)
 
         self.identifier = construct_authorpermvoter(author, permlink, voter)
diff --git a/beemapi/steemnoderpc.py b/beemapi/steemnoderpc.py
index 5be3cee5..6b5198b1 100644
--- a/beemapi/steemnoderpc.py
+++ b/beemapi/steemnoderpc.py
@@ -56,9 +56,11 @@ class SteemNodeRPC(GrapheneRPC):
                 # Forward call to GrapheneWebsocketRPC and catch+evaluate errors
                 self.error_cnt_call = cnt
                 reply = super(SteemNodeRPC, self).rpcexec(payload)
-                if self.next_node_on_empty_reply and not bool(reply):
+                if self.next_node_on_empty_reply and not bool(reply) and self.n_urls > 1:
                     sleep_and_check_retries(self.num_retries_call, cnt, self.url, str("Empty reply"), sleep=False)
                     self.next()
+                    cnt = 0
+                    self.error_cnt_call = 0
                     doRetry = True
                 else:
                     self.next_node_on_empty_reply = False
-- 
GitLab