From 3111bee32fb19a1d0b0b7a2b4edd63d77cfec979 Mon Sep 17 00:00:00 2001
From: Holger Nahrstaedt <holgernahrstaedt@gmx.de>
Date: Wed, 14 Oct 2020 09:46:36 +0200
Subject: [PATCH] Check for existing parameter in comment

---
 beem/cli.py     |  9 ++++++---
 beem/comment.py | 10 ++++++++--
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/beem/cli.py b/beem/cli.py
index ec19930d..44c554ff 100644
--- a/beem/cli.py
+++ b/beem/cli.py
@@ -2506,8 +2506,8 @@ def download(permlink, account, save, export):
         if len(permlink) > 1:
             print(authorperm)
         comment = Comment(authorperm, blockchain_instance=stm)
-        if comment["parent_author"] != "" and comment["parent_permlink"] != "":
-            reply_identifier = construct_authorperm(comment["parent_author"], comment["parent_permlink"])
+        if comment.parent_author != "" and comment.parent_permlink != "":
+            reply_identifier = construct_authorperm(comment.parent_author, comment.parent_permlink)
         else:
             reply_identifier = None
 
@@ -2524,7 +2524,10 @@ def download(permlink, account, save, export):
             yaml_prefix += 'canonical_url: %s\n' % comment.json_metadata["canonical_url"]
         if "app" in comment.json_metadata:
             yaml_prefix += 'app: %s\n' % comment.json_metadata["app"]
-        yaml_prefix += 'last_update: %s\n' % comment.json()["last_update"]
+        if "last_update" in comment.json():
+            yaml_prefix += 'last_update: %s\n' % comment.json()["last_update"]
+        else:
+            yaml_prefix += 'last_update: %s\n' % comment.json()["updated"]
         yaml_prefix += 'max_accepted_payout: %s\n' % str(comment["max_accepted_payout"])
         if "percent_steem_dollars" in comment:
             yaml_prefix += 'percent_steem_dollars: %s\n' %  str(comment["percent_steem_dollars"])
diff --git a/beem/comment.py b/beem/comment.py
index f16775ae..ca70af86 100644
--- a/beem/comment.py
+++ b/beem/comment.py
@@ -269,11 +269,17 @@ class Comment(BlockchainObject):
 
     @property
     def parent_author(self):
-        return self["parent_author"]
+        if "parent_author" in self:
+            return self["parent_author"]
+        else:
+            return ""
 
     @property
     def parent_permlink(self):
-        return self["parent_permlink"]
+        if "parent_permlink" in self:
+            return self["parent_permlink"]
+        else:
+            return ""
 
     @property
     def depth(self):
-- 
GitLab