Beispiel #1
0
	def bracket(self):
		c.javascript.append('/js/jquery-1.4.2.min.js');
		challenge = self.session.query(Challenge).get(int(request.GET.get('id', 0)))
		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')
Beispiel #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')
Beispiel #3
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')
Beispiel #4
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
Beispiel #5
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
Beispiel #6
0
def bracketimg(challengeid):
    (challenge, results) = _loadChallengeResults(challengeid)
    response = make_response(Bracket.image(challenge.depth, results))
    response.headers['Content-type'] = 'image/png'
    return response
Beispiel #7
0
def bracket(challengeid):
    (challenge, results) = _loadChallengeResults(challengeid, load=False)
    (coords, size) = Bracket.coords(challenge.depth)
    return render_template('/challenge/bracketbase.html', challengeid=challengeid, coords=coords, size=size)