Skip to content

Commit 04b08d6

Browse files
committed
bugfix data print
1 parent 8bcc5be commit 04b08d6

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

mytonctrl/mytonctrl.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,8 @@ def PrintBookmarksList(ton, args):
901901
name = item.get("name")
902902
type = item.get("type")
903903
addr = item.get("addr")
904-
data = item.get("data")
905-
table += [[name, type, addr, data]]
904+
bookmark_data = item.get("data")
905+
table += [[name, type, addr, bookmark_data]]
906906
print_table(table)
907907
#end define
908908

@@ -948,14 +948,17 @@ def DeleteBookmark(ton, args):
948948
# #end define
949949

950950
def PrintOffersList(ton, args):
951-
offers = ton.GetOffers()
951+
data = ton.GetOffers()
952+
if (data is None or len(data) == 0):
953+
print("No data")
954+
return
952955
if "--json" in args:
953-
text = json.dumps(offers, indent=2)
956+
text = json.dumps(data, indent=2)
954957
print(text)
955958
else:
956959
table = list()
957960
table += [["Hash", "Votes", "W/L", "Approved", "Is passed"]]
958-
for item in offers:
961+
for item in data:
959962
hash = item.get("hash")
960963
votedValidators = len(item.get("votedValidators"))
961964
wins = item.get("wins")
@@ -1007,14 +1010,17 @@ def GetConfig(ton, args):
10071010

10081011
def PrintComplaintsList(ton, args):
10091012
past = "past" in args
1010-
complaints = ton.GetComplaints(past=past)
1013+
data = ton.GetComplaints(past=past)
1014+
if (data is None or len(complaints)data 0):
1015+
print("No data")
1016+
return
10111017
if "--json" in args:
1012-
text = json.dumps(complaints, indent=2)
1018+
text = json.dumps(data, indent=2)
10131019
print(text)
10141020
else:
10151021
table = list()
10161022
table += [["Election id", "ADNL", "Fine (part)", "Votes", "Approved", "Is passed"]]
1017-
for key, item in complaints.items():
1023+
for key, item in data.items():
10181024
electionId = item.get("electionId")
10191025
adnl = item.get("adnl")
10201026
suggestedFine = item.get("suggestedFine")
@@ -1117,14 +1123,17 @@ def GetDomainFromAuction(ton, args):
11171123

11181124
def PrintElectionEntriesList(ton, args):
11191125
past = "past" in args
1120-
entries = ton.GetElectionEntries(past=past)
1126+
data = ton.GetElectionEntries(past=past)
1127+
if (data is None or len(data) == 0):
1128+
print("No data")
1129+
return
11211130
if "--json" in args:
1122-
text = json.dumps(entries, indent=2)
1131+
text = json.dumps(data, indent=2)
11231132
print(text)
11241133
else:
11251134
table = list()
11261135
table += [["ADNL", "Pubkey", "Wallet", "Stake", "Max-factor"]]
1127-
for key, item in entries.items():
1136+
for key, item in data.items():
11281137
adnl = item.get("adnlAddr")
11291138
pubkey = item.get("pubkey")
11301139
walletAddr = item.get("walletAddr")
@@ -1147,14 +1156,17 @@ def VoteElectionEntry(ton, args):
11471156

11481157
def PrintValidatorList(ton, args):
11491158
past = "past" in args
1150-
validators = ton.GetValidatorsList(past=past)
1159+
data = ton.GetValidatorsList(past=past)
1160+
if (data is None or len(data) == 0):
1161+
print("No data")
1162+
return
11511163
if "--json" in args:
1152-
text = json.dumps(validators, indent=2)
1164+
text = json.dumps(data, indent=2)
11531165
print(text)
11541166
else:
11551167
table = list()
11561168
table += [["ADNL", "Pubkey", "Wallet", "Efficiency", "Online"]]
1157-
for item in validators:
1169+
for item in data:
11581170
adnl = item.get("adnlAddr")
11591171
pubkey = item.get("pubkey")
11601172
walletAddr = item.get("walletAddr")

0 commit comments

Comments
 (0)