def index(): # index_dict used throughout to pass the variables required every time the index page is loaded index_dict = { 'string': '', 'skipped': '', 'counter': dbf.get_counter(), 'current_player': dbf.get_player()[0][1], 'score_table': dbf.get_scores() } return template('/home/drewdavie/mysite/index.tpl', **index_dict)
def new_string(): # if there is already a current string, prevent the user from getting a new string and append a warning if len(dbf.get_current_string()) > 0: index_dict = { 'string': dbf.get_current_string() + '- Solve the current clue!', 'skipped': dbf.get_skipped_string(), 'counter': dbf.get_counter(), 'current_player': dbf.get_player()[0][1], 'score_table': dbf.get_scores() } return (template('/home/drewdavie/mysite/index.tpl', **index_dict)) index_dict = { 'string': dbf.get_new_string(), 'skipped': dbf.get_skipped_string(), 'counter': dbf.get_counter(), 'current_player': dbf.get_player()[0][1], 'score_table': dbf.get_scores() } return (template('/home/drewdavie/mysite/index.tpl', **index_dict))
def skip_string(): # if there is already a skipped string, prevent the user from skipping again and append a warning if len(dbf.get_skipped_string()) > 0: index_dict = { 'string': dbf.get_current_string(), 'skipped': dbf.get_skipped_string() + ' STOP TRYING TO SKIP TWICE.', 'counter': dbf.get_counter(), 'current_player': dbf.get_player()[0][1], 'score_table': dbf.get_scores() } return (template('/home/drewdavie/mysite/index.tpl', **index_dict)) dbf.set_skipped_string() index_dict = { 'string': dbf.get_current_string(), 'skipped': dbf.get_skipped_string(), 'counter': dbf.get_counter(), 'current_player': dbf.get_player()[0][1], 'score_table': dbf.get_scores() } return (template('/home/drewdavie/mysite/index.tpl', **index_dict))
def guessed_string(): # if there isn't a current string then effectively do nothing if dbf.get_current_string == '': index_dict = { 'string': '', 'skipped': dbf.get_skipped_string(), 'counter': dbf.get_counter(), 'current_player': dbf.get_player()[0][1], 'score_table': dbf.get_scores() } return (template('/home/drewdavie/mysite/index.tpl', **index_dict)) dbf.set_guessed_string() index_dict = { 'string': '', 'skipped': dbf.get_skipped_string(), 'counter': dbf.update_counter(), 'current_player': dbf.get_player()[0][1], 'score_table': dbf.get_scores() } return (template('/home/drewdavie/mysite/index.tpl', **index_dict))