Exemple #1
0
def search_clan():
    clan_name = request.form['search']
    logger.info('Search for clan: %s' % clan_name)
    controller = ClanController()
    search_details = controller.find_clan(clan_name)
    if search_details:
        if len(search_details) > 1:
            msg = '{clans} clans were found - please select one from bellow'.format(clans=str(len(search_details)))
            return render_template('home.html', context={'msg': msg, 'search_details': search_details,
                                                         'clan_name': clan_name})
        else:
            clan_id = str((search_details[0]['clan_id']))
            return redirect(url_for('clan_stats', clan_id=clan_id))
            return clan_stats(clan_id)
    else:
        msg = 'Clan was not found with that name or/and tag'
        return render_template('home.html', context={'msg': msg, 'search_details': [], 'clan_name': clan_name})