Exemplo n.º 1
0
def create_auth_id():
    """
    Create and return an unauthenticated auth_id.

    :return: Newly generated auth_id.
    :rtype: ``unicode``
    """
    return "{}{}".format(_UNAUTHENTICATED_PREFIX, create_random_id())
Exemplo n.º 2
0
def create_user(user_class):
    """
    Return a new :class:`webapp2_extras.appengine.auth.models.User` or ``None``
    if there is an error.

    :param class user_class: User class.
    :return: Newly created user.
    :rtype: :class:`webapp2_extras.appengine.auth.models.User` or ``None``
    """
    ok, user = user_class.create_user(auth_id=create_auth_id(), id=create_random_id())
    return user