Skip to content
Snippets Groups Projects
Commit fd5ecd9b authored by Holger Nahrstaedt's avatar Holger Nahrstaedt
Browse files

Fix comment

parent 52203d95
No related branches found
No related tags found
No related merge requests found
...@@ -72,7 +72,7 @@ class Comment(BlockchainObject): ...@@ -72,7 +72,7 @@ class Comment(BlockchainObject):
self[p] = Amount(self.get(p, "0.000 SBD"), steem_instance=self.steem) self[p] = Amount(self.get(p, "0.000 SBD"), steem_instance=self.steem)
# turn json_metadata into python dict # turn json_metadata into python dict
self.__metadata_to_dict() self._metadata_to_dict()
self["tags"] = [] self["tags"] = []
self['community'] = '' self['community'] = ''
if isinstance(self['json_metadata'], dict): if isinstance(self['json_metadata'], dict):
...@@ -84,13 +84,13 @@ class Comment(BlockchainObject): ...@@ -84,13 +84,13 @@ class Comment(BlockchainObject):
def _metadata_to_dict(self): def _metadata_to_dict(self):
"""turn json_metadata into python dict""" """turn json_metadata into python dict"""
meta_str = self.get("json_metadata", "{}") meta_str = self.get("json_metadata", "{}")
if meta_str == "{}":
self['json_metadata'] = meta_str
if isinstance(meta_str, (string_types, bytes_types, bytearray)): if isinstance(meta_str, (string_types, bytes_types, bytearray)):
try: try:
self['json_metadata'] = json.loads(meta_str) self['json_metadata'] = json.loads(meta_str)
except: except:
self['json_metadata'] = {} self['json_metadata'] = {}
else:
self['json_metadata'] = {}
def refresh(self): def refresh(self):
if self.identifier == "": if self.identifier == "":
......
...@@ -100,7 +100,7 @@ class Vote(BlockchainObject): ...@@ -100,7 +100,7 @@ class Vote(BlockchainObject):
if x["voter"] == voter: if x["voter"] == voter:
vote = x vote = x
if not vote: if not vote:
raise VoteDoesNotExistsException raise VoteDoesNotExistsException(self.identifier)
super(Vote, self).__init__(vote, id_item="authorpermvoter", steem_instance=self.steem) super(Vote, self).__init__(vote, id_item="authorpermvoter", steem_instance=self.steem)
self.identifier = construct_authorpermvoter(author, permlink, voter) self.identifier = construct_authorpermvoter(author, permlink, voter)
......
...@@ -56,9 +56,11 @@ class SteemNodeRPC(GrapheneRPC): ...@@ -56,9 +56,11 @@ class SteemNodeRPC(GrapheneRPC):
# Forward call to GrapheneWebsocketRPC and catch+evaluate errors # Forward call to GrapheneWebsocketRPC and catch+evaluate errors
self.error_cnt_call = cnt self.error_cnt_call = cnt
reply = super(SteemNodeRPC, self).rpcexec(payload) 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) sleep_and_check_retries(self.num_retries_call, cnt, self.url, str("Empty reply"), sleep=False)
self.next() self.next()
cnt = 0
self.error_cnt_call = 0
doRetry = True doRetry = True
else: else:
self.next_node_on_empty_reply = False self.next_node_on_empty_reply = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment