Пример #1
0
 def blankbracket(self):
     try:
         response.headers['Content-type'] = 'image/png'
         return Bracket(myint(request.GET.get('depth', 2))).getImage()
     except Exception, e:
         response.headers['Content-type'] = 'text/plain'
         return "Failed to draw bracket, did you install PIL? (%s)" % e
Пример #2
0
 def bracket(self):
     c.javascript.append('/js/external/jquery-1.9.0.js')
     challenge = self.session.query(Challenge).get(
         myint(request.GET.get('id', 0)))
     if challenge is None:
         abort(404, "Invalid or no challenge id")
     b = Bracket(
         challenge.depth)  # Just getting the coords, no drawing takes place
     b.getImage()
     c.coords = b.getCoords()
     c.cid = challenge.id
     return render_mako('/challenge/bracketbase.mako')
Пример #3
0
    def bracketimg(self):
        id = myint(request.GET.get('id', 0))
        challenge = self.session.query(Challenge).get(id)
        if challenge is None:
            return ''

        rounds = dict()
        for rnd in self.session.query(ChallengeRound).filter(
                ChallengeRound.challengeid == id).all():
            rounds[rnd.round] = rnd

        loadChallengeResults(self.session, challenge.id, rounds)

        try:
            response.headers['Content-type'] = 'image/png'
            return Bracket(challenge.depth, rounds).getImage()
        except Exception, e:
            response.headers['Content-type'] = 'text/plain'
            return "Failed to draw bracket, did you install PIL? (%s)" % e