Exemplo n.º 1
0
def _check_username(username):
    """
    Checks that a username is valid and is not already in use. Returns
    the username if valid, or None if it is not.
    """
    checked_name = None
    if username is not None and username != "":
        user_db = UserDB()
        exists = user_db.find_user_by_name(username)
        if exists == []:
            checked_name = username
    return checked_name