def get(self):
        update_session_time()
        session = get_current_session()
        check_session_status()
            
        if session.is_active():
            member_request = CARequestGroupMembership.get(Key(self.request.get('request')))
            CARequestGroupMembership.delete(member_request)
            
#            template_values = {
#                'session_status': True,
#                'user': session['active_user'],
#                'pending_membership_requests': get_pending_membership_requests(session['active_user']),
#                'top_scorers': get_top_scorers(),
#                'top_users': get_top_users_global_ranking()
#            }
#                        
#            render_template(self, 'home.html', template_values)
            self.redirect('/list/groups/view')
        else:
            self.redirect('/')
    def get(self):
        update_session_time()
        session = get_current_session()
        check_session_status()
            
        if session.is_active():
            member_request = CARequestGroupMembership.get(Key(self.request.get('request')))
            active_user = session['active_user']
            
            active_user.groups.append(member_request.group.key())
            active_user.put()
            
            active_user_football_pools = CAFootballPool.all().filter("user ="******"privacy =", False).fetch(1000)
            members = member_request.group.members.fetch(10000)
                
            for football_pool in active_user_football_pools:
                if football_pool.payment:
                    groups = active_user.groups
                        
                    group_ranking = CAGroupRanking(football_pool=football_pool, group=member_request.group, rank=len(members))
                    group_ranking.put()
                    
            CARequestGroupMembership.delete(member_request)
            
#            template_values = {
#                'session_status': True,
#                'user': session['active_user'],
#                'top_scorers': get_top_scorers(),
#                'top_users': get_top_users_global_ranking(),
#                'last_jackpot': get_last_jackpot()
#            }
#                        
#            render_template(self, 'home.html', template_values)
            self.redirect('/list/groups/view')
        else:
            self.redirect('/')