#NEWLINE# @ login_mgr . user_loader #NEWLINE# def load_user( id ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if isinstance ( id , int ) : #NEWLINE# #INDENT# return User . query . get ( id ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cred = Credential . query . filter_by ( type = 'indieauth' , value = id ) . first ( ) #NEWLINE# return ( cred and cred . user ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# current_app . logger . exception ( 'loading current user' )