def get_token_status(token, serializer, max_age=None, return_data=False):
 serializer = getattr(_security, (serializer + '_serializer'))
 max_age = get_max_age(max_age)
 (user, data) = (None, None)
 (expired, invalid) = (False, False)
 try:
  data = serializer.loads(token, max_age=max_age)
 except SignatureExpired:
  (d, data) = serializer.loads_unsafe(token)
  expired = True
 except (BadSignature, TypeError, ValueError):
  invalid = True
 if data:
  user = _datastore.find_user(id=data[0])
 expired = (expired and (user is not None))
 if return_data:
  return (expired, invalid, user, data)
 else:
  return (expired, invalid, user)

def get_token_status ( token , serializer , max_age = None , return_data = False ) : serializer = getattr ( _security , ( serializer + '_serializer' ) ) max_age = get_max_age ( max_age ) ( user , data ) = ( None , None ) ( expired , invalid ) = ( False , False ) try : data = serializer . loads ( token , max_age = max_age ) except SignatureExpired : ( d , data ) = serializer . loads_unsafe ( token ) expired = True except ( BadSignature , TypeError , ValueError ) : invalid = True if data : user = _datastore . find_user ( id = data [ 0 ] ) expired = ( expired and ( user is not None ) ) if return_data : return ( expired , invalid , user , data ) else : return ( expired , invalid , user )
get the status of a token .