def get(self, key_name):
     
     memcache_key = "match_detail_%s" % key_name
     html = memcache.get(memcache_key)
     
     if html is None:
         match = Match.get_by_key_name(key_name)
         if not match:
             # TODO: Add real "match not found" template
             self.response.out.write("404.")
             return None
         
         match.unpack_json()
         
         tbavideo = None
         if match.tbavideo_set.count() > 0:
             tbavideo = match.tbavideo_set[0]
         
         template_values = {
             "match": match,
             "tbavideo": tbavideo,
         }
         
         path = os.path.join(os.path.dirname(__file__), '../templates/matches/details.html')
         html = template.render(path, template_values)
         memcache.add(memcache_key, html, 600)
     
     self.response.out.write(html)
    def get(self, match_key):
        match = Match.get_by_key_name(match_key)
        
        template_values = {
            "match": match
        }

        path = os.path.join(os.path.dirname(__file__), '../../templates/admin/matches/edit.html')
        self.response.out.write(template.render(path, template_values))
예제 #3
0
    def findOrSpawn(self, new_match):
        """
        Check whether a match already exists. 
        If it does, update the data, and send it back.
        If it doesn't, send it back.
        """
        match = Match.get_by_key_name(new_match.get_key_name())
        if match is not None:
            new_match = self.updateMerge(new_match, match)

        return new_match