More debugging

Trying to understand what's coming over the wire again
This commit is contained in:
Cy 2020-06-01 07:48:46 +00:00 committed by Cy
parent 0b418f985d
commit 9dd5e44e6f
1 changed files with 10 additions and 18 deletions

View File

@ -710,31 +710,23 @@ def same_username(account, acct, username):
myhost = account.username.split("@",1)[1] myhost = account.username.split("@",1)[1]
if acct == user and host == myhost: return True if acct == user and host == myhost: return True
return False return False
from pprint import pprint
@br_login_required @br_login_required
def user(request, username, prev=None, next=None): def user(request, username, prev=None, next=None):
try: try:
account, mastodon = get_usercontext(request) account, mastodon = get_usercontext(request)
except NotLoggedInException: except NotLoggedInException:
return redirect(about) return redirect(about)
user_dict = [] user_dict = None
print("username",username)
for dict in mastodon.account_search(username): for dict in mastodon.account_search(username):
if same_username(account, dict.acct ,username): continue pprint(("check", dict))
raise SystemExit(23)
try: if not same_username(account, dict.acct, username): continue
user_dict = [ user_dict = dict
dict break
else:
if ( raise Http404(_("The user %s could not be found.") % username)
(dict.acct == username)
or (
dict.acct == username.split("@")[0]
and
)
)
][0]
except (IndexError, AttributeError) as e:
raise Http404(_("The user %s could not be found. %s") % (username, e))
data = mastodon.account_statuses(user_dict.id, max_id=next, min_id=prev) data = mastodon.account_statuses(user_dict.id, max_id=next, min_id=prev)
relationship = mastodon.account_relationships(user_dict.id)[0] relationship = mastodon.account_relationships(user_dict.id)[0]
notifications = _notes_count(account, mastodon) notifications = _notes_count(account, mastodon)