Skip to content
Snippets Groups Projects
Commit 1d0a9167 authored by Pawel Maniora's avatar Pawel Maniora
Browse files

observer validation

parent 45c28831
No related branches found
No related tags found
2 merge requests!456Release candidate v1 24,!280observer validation
...@@ -53,6 +53,7 @@ async def get_post(context, author, permlink, observer=None): ...@@ -53,6 +53,7 @@ async def get_post(context, author, permlink, observer=None):
#TODO: `observer` logic for user-post state #TODO: `observer` logic for user-post state
db = context['db'] db = context['db']
valid_account(author) valid_account(author)
valid_account(observer, allow_empty=True)
valid_permlink(permlink) valid_permlink(permlink)
blacklists_for_user = None blacklists_for_user = None
...@@ -286,6 +287,7 @@ async def get_account_posts(context, sort:str, account:str, start_author:str='', ...@@ -286,6 +287,7 @@ async def get_account_posts(context, sort:str, account:str, start_author:str='',
account = valid_account(account) account = valid_account(account)
start_author = valid_account(start_author, allow_empty=True) start_author = valid_account(start_author, allow_empty=True)
start_permlink = valid_permlink(start_permlink, allow_empty=True) start_permlink = valid_permlink(start_permlink, allow_empty=True)
observer = valid_account(observer, allow_empty=True)
limit = valid_limit(limit, 100, 20) limit = valid_limit(limit, 100, 20)
sql = None sql = None
...@@ -304,8 +306,6 @@ async def get_account_posts(context, sort:str, account:str, start_author:str='', ...@@ -304,8 +306,6 @@ async def get_account_posts(context, sort:str, account:str, start_author:str='',
elif sort == 'payout': elif sort == 'payout':
sql = "SELECT * FROM bridge_get_account_posts_by_payout( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::SMALLINT )" sql = "SELECT * FROM bridge_get_account_posts_by_payout( (:account)::VARCHAR, (:author)::VARCHAR, (:permlink)::VARCHAR, (:limit)::SMALLINT )"
observer = valid_account(observer, allow_empty=True)
sql_result = await db.query_all(sql, account=account, author=start_author, permlink=start_permlink, limit=limit ) sql_result = await db.query_all(sql, account=account, author=start_author, permlink=start_permlink, limit=limit )
posts = [] posts = []
blacklists_for_user = None blacklists_for_user = None
......
Subproject commit ecafd7682f26b8fdee3330ac32a8de9916a3d401 Subproject commit 7a2a223165ef5903db70e28335106d2c33feec49
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