<s> from django . core . paginator import Paginator , EmptyPage , PageNotAnInteger <EOL> from django . shortcuts import render , redirect <EOL> from dotastats . json import steamapi <EOL> from django . views . decorators . cache import cache_page <EOL> def home ( request ) : <EOL> return render ( request , '<STR_LIT>' ) <EOL> @ cache_page ( <NUM_LIT> * <NUM_LIT:1> ) <EOL> def matches_overview ( request ) : <EOL> match_history_list = steamapi . GetLatestMatches ( ) <EOL> paginator = Paginator ( match_history_list , <NUM_LIT> ) <EOL> page = request . GET . get ( '<STR_LIT>' ) <EOL> try : <EOL> match_history = paginator . page ( page ) <EOL> except PageNotAnInteger : <EOL> match_history = paginator . page ( <NUM_LIT:1> ) <EOL> except EmptyPage : <EOL> match_history = paginator . page ( paginator . num_pages ) <EOL> return render ( request , '<STR_LIT>' , { '<STR_LIT>' : match_history } ) <EOL> @ cache_page ( <NUM_LIT> * <NUM_LIT:5> ) <EOL> def matches_id ( request , match_id ) : <EOL> result_match = steamapi . GetMatchDetails ( match_id ) <EOL> return render ( request , '<STR_LIT>' , { '<STR_LIT>' : result_match , '<STR_LIT>' : ( result_match . get_radiant_players ( ) , result_match . get_dire_players ( ) ) } ) <EOL> def about ( request ) : <EOL> return render ( request , '<STR_LIT>' ) <EOL> def news ( request ) : <EOL> return render ( request , '<STR_LIT>' ) <EOL> def leagues ( request ) : <EOL> return render ( request , '<STR_LIT>' ) <EOL> def search ( request , search_param = None ) : <EOL> error = None <EOL> if search_param == None : <EOL> search_param = "<STR_LIT>" <EOL> if len ( search_param ) < <NUM_LIT:2> : <EOL> error = "<STR_LIT>" <EOL> result_dict = dict ( { '<STR_LIT:error>' : error , <EOL> '<STR_LIT>' : search_param } ) <EOL> return render ( request , '<STR_LIT>' , result_dict ) <EOL> def heroes ( request , hero_name = None ) : <EOL> return render ( request , '<STR_LIT>' ) <EOL> def players ( request , player_id = None , player_url = None ) : <EOL> return render ( request , '<STR_LIT>' ) </s>
