Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
beem
Commits
664bbaa0
Commit
664bbaa0
authored
6 years ago
by
Holger
Browse files
Options
Downloads
Patches
Plain Diff
Add get_all_replies to comment for fetching all replies
parent
fc856711
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.rst
+6
-0
6 additions, 0 deletions
README.rst
beem/comment.py
+15
-1
15 additions, 1 deletion
beem/comment.py
tests/beem/test_comment.py
+23
-4
23 additions, 4 deletions
tests/beem/test_comment.py
with
44 additions
and
5 deletions
README.rst
+
6
−
0
View file @
664bbaa0
...
...
@@ -156,6 +156,12 @@ before transmitting the packed file. Please check the hash-sum after downloading
Changelog
=========
0.19.48
-------
* Fix issue #45 (upvote() and downvote() of a pending post/comment without vote did not work)
* fix Amount for condenser broadcast ops on appbase nodes (fixes transfer broadcast for example)
* Added get_all_replies() to Comment for fetching all replies to a post
0.19.47
-------
* Some bug fixes
...
...
This diff is collapsed.
Click to expand it.
beem/comment.py
+
15
−
1
View file @
664bbaa0
...
...
@@ -516,7 +516,7 @@ class Comment(BlockchainObject):
return
self
.
steem
.
rpc
.
get_reblogged_by
(
post_author
,
post_permlink
,
api
=
"
follow
"
)
def
get_replies
(
self
,
raw_data
=
False
,
identifier
=
None
):
"""
Returns
all
content replies
"""
Returns content replies
:param bool raw_data: When set to False, the replies will be returned as Comment class objects
"""
...
...
@@ -536,6 +536,20 @@ class Comment(BlockchainObject):
return
content_replies
return
[
Comment
(
c
,
steem_instance
=
self
.
steem
)
for
c
in
content_replies
]
def
get_all_replies
(
self
,
parent
=
None
):
"""
Returns all content replies
"""
if
parent
is
None
:
parent
=
self
if
parent
[
"
children
"
]
>
0
:
children
=
parent
.
get_replies
()
if
children
is
None
:
return
[]
for
cc
in
children
[:]:
children
.
extend
(
self
.
get_all_replies
(
parent
=
cc
))
return
children
return
[]
def
get_votes
(
self
,
raw_data
=
False
):
"""
Returns all votes as ActiveVotes object
"""
if
raw_data
:
...
...
This diff is collapsed.
Click to expand it.
tests/beem/test_comment.py
+
23
−
4
View file @
664bbaa0
...
...
@@ -38,7 +38,7 @@ class Testcases(unittest.TestCase):
num_retries
=
10
)
acc
=
Account
(
"
holger80
"
,
steem_instance
=
cls
.
bts
)
comment
=
acc
.
get_
blog
(
limit
=
20
)[
-
1
]
comment
=
acc
.
get_
feed
(
limit
=
20
)[
-
1
]
cls
.
authorperm
=
comment
.
authorperm
[
author
,
permlink
]
=
resolve_authorperm
(
cls
.
authorperm
)
cls
.
author
=
author
...
...
@@ -63,7 +63,16 @@ class Testcases(unittest.TestCase):
exceptions
.
ContentDoesNotExistsException
):
Comment
(
"
@abcdef/abcdef
"
,
steem_instance
=
bts
)
c
=
Comment
(
self
.
authorperm
,
steem_instance
=
bts
)
title
=
''
cnt
=
0
while
title
==
''
and
cnt
<
5
:
c
=
Comment
(
self
.
authorperm
,
steem_instance
=
bts
)
title
=
c
.
title
cnt
+=
1
if
title
==
''
:
c
.
steem
.
rpc
.
next
()
c
.
refresh
()
title
=
c
.
title
self
.
assertTrue
(
isinstance
(
c
.
id
,
int
))
self
.
assertTrue
(
c
.
id
>
0
)
self
.
assertEqual
(
c
.
author
,
self
.
author
)
...
...
@@ -97,8 +106,18 @@ class Testcases(unittest.TestCase):
bts
=
self
.
bts
else
:
bts
=
self
.
appbase
c
=
Comment
({
'
author
'
:
self
.
author
,
'
permlink
'
:
self
.
permlink
},
steem_instance
=
bts
)
c
.
refresh
()
title
=
''
cnt
=
0
while
title
==
''
and
cnt
<
5
:
c
=
Comment
({
'
author
'
:
self
.
author
,
'
permlink
'
:
self
.
permlink
},
steem_instance
=
bts
)
c
.
refresh
()
title
=
c
.
title
cnt
+=
1
if
title
==
''
:
c
.
steem
.
rpc
.
next
()
c
.
refresh
()
title
=
c
.
title
self
.
assertEqual
(
c
.
author
,
self
.
author
)
self
.
assertEqual
(
c
.
permlink
,
self
.
permlink
)
self
.
assertEqual
(
c
.
authorperm
,
self
.
authorperm
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment