def plot_sparkline_smooth(results, args):
   step = int(args.get('step', '2'))
   height = int(args.get('height', '20'))
   (dmin, dmax) = [int(x) for x in args.get('limits', '0,100').split(',')]
   im = PNGCanvas((len(results)-1)*step+4, height)
   im.color = rgb.colors['white']
   im.filledRectangle(0, 0, im.width-1, im.height-1)

   coords = zip(range(1,len(results)*step+1, step), [height - 3  - (y-dmin)/(float(dmax - dmin +1)/(height-4)) for y in results])
   im.color = [128, 128, 128, 255]
   lastx, lasty = coords[0]
   for x0, y0, in coords:
     im.line(lastx, lasty, x0, y0)
     lastx, lasty = x0, y0
   min_color = rgb.colors[args.get('min-color', 'green')]
   max_color = rgb.colors[args.get('max-color', 'red')]
   last_color = rgb.colors[args.get('last-color', 'blue')]
   has_min = args.get('min-m', 'false')
   has_max = args.get('max-m', 'false')
   has_last = args.get('last-m', 'false')
   if has_min == 'true':
      min_pt = coords[results.index(min(results))]
      im.color = min_color
      im.rectangle(min_pt[0]-1, min_pt[1]-1, min_pt[0]+1, min_pt[1]+1)
   if has_max == 'true':
      im.color = max_color
      max_pt = coords[results.index(max(results))]
      im.rectangle(max_pt[0]-1, max_pt[1]-1, max_pt[0]+1, max_pt[1]+1)
   if has_last == 'true':
      im.color = last_color
      end = coords[-1]
      im.rectangle(end[0]-1, end[1]-1, end[0]+1, end[1]+1)
   return im.dump()
Esempio n. 2
0
def plot_sparkline_smooth(results, args):
   step = int(args.get('step', '2'))
   height = int(args.get('height', '20'))
   (dmin, dmax) = [int(x) for x in args.get('limits', '0,100').split(',')]
   im = PNGCanvas((len(results)-1)*step+4, height)
   im.color = rgb.colors('white')
   im.filledRectangle(0, 0, im.width-1, im.height-1)
   coords = zip(range(1,len(results)*step+1, step), [height - 3  - (y-dmin)/(float(dmax - dmin +1)/(height-4)) for y in results])
   im.color = rgb.colors('gray53')
   lastx, lasty = coords[0]
   for x0, y0, in coords:
     im.line(lastx, lasty, x0, y0)
     lastx, lasty = x0, y0
   min_color = rgb.colors(args.get('min-color', 'green'))
   max_color = rgb.colors(args.get('max-color', 'red'))
   last_color = rgb.colors(args.get('last-color', 'blue'))
   has_min = args.get('min-m', 'false')
   has_max = args.get('max-m', 'false')
   has_last = args.get('last-m', 'false')
   if has_min == 'true':
      min_pt = coords[results.index(min(results))]
      im.color = min_color
      im.filledRectangle(min_pt[0]-1, min_pt[1]-1, min_pt[0]+1, min_pt[1]+1)
   if has_max == 'true':
      im.color = max_color
      max_pt = coords[results.index(max(results))]
      im.filledRectangle(max_pt[0]-1, max_pt[1]-1, max_pt[0]+1, max_pt[1]+1)
   if has_last == 'true':
      im.color = last_color
      end = coords[-1]
      im.filledRectangle(end[0]-1, end[1]-1, end[0]+1, end[1]+1)
   return im.dump()
def plot_sparkline_discrete(results, args, longlines=False):
    """The source data is a list of values between
      0 and 100 (or 'limits' if given). Values greater than 95 
      (or 'upper' if given) are displayed in red, otherwise 
      they are displayed in green"""
    width = int(args.get('width', '2'))
    height = int(args.get('height', '14'))
    upper = int(args.get('upper', '50'))
    below_color = args.get('below-color', 'gray')
    above_color = args.get('above-color', 'red')
    gap = 4
    if longlines:
        gap = 0
    im = PNGCanvas(len(results)*width-1, height)
    im.color = rgb.colors['white']
    im.filledRectangle(0, 0, im.width-1, im.height-1)

    (dmin, dmax) = [int(x) for x in args.get('limits', '0,100').split(',')]
    if dmax < dmin:
        dmax = dmin
    zero = im.height - 1
    if dmin < 0 and dmax > 0:
        zero = im.height - (0 - dmin) / (float(dmax - dmin + 1) / (height - gap))
    for (r, i) in zip(results, range(0, len(results)*width, width)):
        color = (r >= upper) and above_color or below_color
        if r < 0:
            y_coord = im.height - (r - dmin) / (float(dmax - dmin + 1) / (height - gap))
        else:
            y_coord = im.height - (r - dmin) / (float(dmax - dmin + 1) / (height - gap))
        im.color = rgb.colors[color]
        if longlines:
            im.filledRectangle(i, zero, i+width-2, y_coord)
        else:
            im.rectangle(i, y_coord - gap, i+width-2, y_coord)
    return im.dump()
Esempio n. 4
0
def plot_sparkline_discrete(results, args, longlines=False):
    """The source data is a list of values between
      0 and 100 (or 'limits' if given). Values greater than 95 
      (or 'upper' if given) are displayed in red, otherwise 
      they are displayed in green"""
    width = int(args.get('width', '2'))
    height = int(args.get('height', '14'))
    upper = int(args.get('upper', '50'))
    below_color = args.get('below-color', 'dark gray')
    above_color = args.get('above-color', 'red')
    gap = 4
    if longlines:
        gap = 0
    im = PNGCanvas(len(results)*width-1, height)
    im.color = rgb.colors('white')
    im.filledRectangle(0, 0, im.width-1, im.height-1)

    (dmin, dmax) = [int(x) for x in args.get('limits', '0,100').split(',')]
    if dmax < dmin:
        dmax = dmin
    zero = im.height - 1
    if dmin < 0 and dmax > 0:
        zero = im.height - (0 - dmin) / (float(dmax - dmin + 1) / (height - gap))
    for (r, i) in zip(results, range(0, len(results)*width, width)):
        color = (r >= upper) and above_color or below_color
        if r < 0:
            y_coord = im.height - (r - dmin) / (float(dmax - dmin + 1) / (height - gap))
        else:
            y_coord = im.height - (r - dmin) / (float(dmax - dmin + 1) / (height - gap))
        im.color = rgb.colors(color)
        if longlines:
            im.filledRectangle(i, zero, i+width-2, y_coord)
        else:
            im.filledRectangle(i, y_coord - gap, i+width-2, y_coord)
    return im.dump()
Esempio n. 5
0
def png_sparkline(numbers, width=60, height=14, color=None, bgcolor='white'):
    if len(numbers) > width: return None
    color = png_colors.get(color) or png_colors.get('blue')
    bgcolor = png_colors.get(bgcolor) or png_colors.get('white')
    img = PNGCanvas(width, height, color=color, bgcolor=bgcolor)
    img.color = color
    _draw_series(img, numbers, width, height)
    return img.dump()
Esempio n. 6
0
def make_ranking_icon(request, id = None, icon = False):

	if id or icon: # make the smaller version for display (the id) or for saving to the server
		width = 80
		height = 40
	else:	
		width = 200
		height = 200

	colors = ([0x25, 0x67, 0x79, 0xff], [0xaf, 0xf3, 0x9b, 0xff], [0xed, 0x1e, 0x79, 0xff], [0x29, 0xaa, 0xe2, 0xff], [0x4d, 0x42, 0x4c, 0xff])

        weights = request.session.get('source_weights', DefaultWeights)
        sources_to_aggregate = request.session.get('sources_to_aggregate', DefaultSources)

	c = PNGCanvas(width,height)
	num_colors = len(colors)

#	f = open("/var/www/media/handle.png", "rb")
#	handle = PNGCanvas(12,12)
#	handle.load(f)
	
	num_sources = len(sources_to_aggregate)
	if num_sources == 0:
		return HttpResponse(mimetype='image/png', content=c.dump())

	bar_width = width / num_sources
	half = bar_width / 2

	i = 0
	for source in sources_to_aggregate:
		c.color = DataSourceColor.objects.get(datasource=source).color_as_array() #colors[i % num_colors]
		bar_height = height - height * (weights[source] / 10.0)
		c.filledRectangle(bar_width * i, bar_height, bar_width * (i + 1) - 1, height)
			
#		handle.copyRect(0,0,11,11,10,10,c) #int(bar_height + 6), bar_width * i + half,c)

		i += 1


	if id:
		f = open("/var/www/media/ranking_icons/icon%d.png" % id, "wb")
		f.write(c.dump())
		f.close()
	else:
		return HttpResponse(mimetype='image/png', content=c.dump())
Esempio n. 7
0
def plot_error(results, args):
    im = PNGCanvas(40, 15)
    im.color = rgb.colors['red']
    im.line(0, 0, im.width - 1, im.height - 1)
    im.line(0, im.height - 1, im.width - 1, 0)
    return im.dump()
def plot_error(results, args):
   im = PNGCanvas(40, 15)
   im.color = rgb.colors['red']
   im.line(0, 0, im.width, im.height)
   im.line(0, im.height, im.width, 0)
   return im.dump()
Esempio n. 9
0
  def cont(self,req,modname,rparameters):
    param=urlparam(rparameters)
    ext=param['ext']
    lang=param['lang']
    aps=param['aps']
    kalb=param['kalb']
    lang1 = gettext.translation (cmstrans2, locale_path, [kalb] , fallback=True) 
    _ = lang1.ugettext
    modname2 = 'custommodule'

    if not req.request.get('cmd'):
		page = Page.loadnew(modname2)
    
		greeting = ''
		bio_cgi_url = "/bioview"
		bio_cgi_url = ("%s/%s-mo2%s-%s.%s" % (urlhost2(), cmspath2,modname,lang, fileext))

		gimmet=''
		gimmen=''
		gimdien=''
		simbsafe  = re.compile("[^0-9a-zA-Z]")
		mazosios  = re.compile("[^a-z]")
		skaic  = re.compile("[^0-9]")
		handler = {}
		if 'HTTP_COOKIE' in os.environ:
			cookies = os.environ['HTTP_COOKIE']
			cookies = cookies.split('; ')
			for cookie in cookies:
				cookie = cookie.split('=')
				handler[cookie[0]] = cookie[1]
		if 'terebasGimd' in handler:
			gimd = handler['terebasGimd']
			gimd = "%s" % (skaic.sub("", gimd))
		try:
			gimmet=gimd[0,4]
			gimmen=gimd[4,6]
			gimdien=gimd[6,8]
		except:
			zerr = True
		unixtime=time.time()
		d = datetime.datetime.fromtimestamp(unixtime)
		lang = req.request.get('lang') or 'lt'
		gimmet = req.request.get('gmet') or gimmet
		gimmen = req.request.get('gmem') or gimmen
		gimdien = req.request.get('gdien') or gimdien
		siemet = req.request.get('smet') or d.strftime('%Y')
		men = req.request.get('men') or d.strftime('%m')
		biohtml=''
		if not lang:
			lang = 'lt'
		else:
			lang = mazosios.sub("", lang)
		if not gimmet:
			gimmet = '1970'
		else:
			gimmet = skaic.sub("", gimmet)
		if not gimmen:
			gimmen = '06'
		else:
			gimmen = skaic.sub("", gimmen)
		if not gimdien:
			gimdien = '20'
		else:
			gimdien = skaic.sub("", gimdien)
		if not siemet:
			format = '%Y'
			siemet = d.strftime(format)
		else:
			siemet = skaic.sub("", siemet)
		if not men:
			format = '%m'
			men = d.strftime(format)
		else:
			men = skaic.sub("", men)
		if req.request.get('gmet') and req.request.get('gmem') and req.request.get('gdien'):
			bioduom = "lang="+lang+"&amp;gmet="+gimmet+"&amp;gmem="+gimmen+"&amp;gdien="+gimdien+"&amp;smet="+siemet+"&amp;men="+men
			biohtml = "<img src=\""+bio_cgi_url+"?cmd=1&amp;"+bioduom+"\" height=\"256\" width=\"256\" alt=\"\" />\n"
		template_values2 = {
			'biohtml': biohtml,
			'gimmet': gimmet,
			'gimmen': gimmen,
			'gimdien': gimdien,
			'siemet': siemet,
			'men': men
		}
		directory = os.path.dirname(__file__)
		path = os.path.join(directory,  "bio.html")
		cont1 = template.render(path, template_values2, debug=_DEBUG)

		page.content = cont1
		page_name2 = 'menu'+'-'+lang+'.'+fileext
		page2 = Page.load(page_name2)
		page3 = Page.loadnew("kalbos")
		textaps=''
		if len(aps)>0:
			textaps=aps+'.'
		text=''
		for name, value in kalbossort:
			text = text + (_kalbhtml % ('mo2'+modname, textaps+name, ext, name, name))
		page3.content = text
		req.generate('view.html', lang, {
			'imgshar': False,
			'noedit': '1',
			'application_name': siteauth(),
			'kalbos': page3,
			'menu': page2,
			'page': page,
			})
    elif req.request.get('cmd') == '1':
		
		unixtime=time.time()
		d = datetime.datetime.fromtimestamp(unixtime)
		lang = req.request.get('lang') or 'lt'
		gimmet = req.request.get('gmet') or '1970'
		gimmen = req.request.get('gmem') or '06'
		gimdien = req.request.get('gdien') or '20'
		siemet = req.request.get('smet') or d.strftime('%Y')
		men = req.request.get('men') or d.strftime('%m')
		simbsafe  = re.compile("[^0-9a-zA-Z]")
		mazosios  = re.compile("[^a-z]")
		skaic  = re.compile("[^0-9]")
		if not lang:
			lang = 'lt'
		else:
			lang = mazosios.sub("", lang)
		if not gimmet:
			gimmet = '1970'
		else:
			gimmet = skaic.sub("", gimmet)
		if not gimmen:
			gimmen = '06'
		else:
			gimmen = skaic.sub("", gimmen)
		if not gimdien:
			gimdien = '20'
		else:
			gimdien = skaic.sub("", gimdien)
		if not siemet:
			format = '%Y'
			siemet = d.strftime(format)
		else:
			siemet = skaic.sub("", siemet)
		if not men:
			format = '%m'
			men = d.strftime(format)
		else:
			men = skaic.sub("", men)



		format = '%H:%i:%s %m/%d/%Y %O'
		date = d.strftime(format)


		if lang == 'en':
			bio_new = 'bio_en8.png'
			strbio = "Biorhythms"
			strfiz = "Physical State"
			stremo = "Emotional State"
			strint = "Intellect"
			strmd = "Days of the Month"
			strid = "Survived Days"
			strgd = "Date of Birth"
			strm = "Month"
		else:
			bio_new = 'bio_lt8.png'
			strbio = "Bioritmai"
			strfiz = "Fizin\xEB bukl\xEB"
			stremo = "Emocin\xEB b\xFBsena"
			strint = "Intelektas"
			strmd = "Menesio dienos"
			strid = "I\xF0gyventa dien\xF8"
			strgd = "Gimimo data"
			strm = "M\xEBnuo"
		bio_new = '1m.png'
		color1 = [106, 0,0,0]
		color2 = [0xff, 0xff, 0, 0xff]
		color3 = [128, 255, 0, 0xff]
		color4 = [0,128,255, 0xff]
		color5 = [255,128,255, 0xff]
		color6 = [255,255,0, 0xff]
		color1 = [0x00, 0x30,0xd2,0xFF]
		color2 = [0xf6, 0xf3, 0x00, 0xff]
		color3 = [0xfe, 0x7f, 0xfe, 0xff]
		color4 = [0x7f, 0xfe, 0x00, 0xff]
		color5 = [255,128,255, 0xff]
		color6 = [255,255,0, 0xff]
		color1 = [0xAC, 0x2F,0x93,0xFF]
		color1 = [0x00, 0x00,0x8e,0xFF]
		color2 = [0xCA, 0x45, 0x46, 0xff]
		color3 = [0xd3, 0xa5, 0x6a, 0xff]
		color4 = [0x71, 0xa4, 0xcf, 0xff]
		color5 = [0xfd, 0xd9, 0x13, 0xff]
		color1 = [0x00, 0x00,0x8e,0xFF]
		color2 = [0x2b, 0xf6, 0x42, 0xff]
		color3 = [0xfc, 0xf1, 0x33, 0xff]
		color4 = [0xf8, 0x01, 0xd6, 0xff]
		color5 = [0xff, 0x0e, 0x06, 0xff]
		color6 = [255,255,0, 0xff]
#f6f300
#fe7ffe
#000000
#7ffe00
#0030d2

#00008e - fonas melyna
# ff0e06 raud
#2bf642 zalia
#fcf133 gel
#f801d6 viol


		cikfiz = 23
		cikemo = 28
		cikint = 33
		ilg = [0,31,28,31,30,31,30,31,31,30,31,30,31]

		ys=0
		derr = False
		if gimmet<1970:
			ys=1970-int(gimmet)
		try:
			year=int(gimmet)+ys
			tt1 = datetime.date(int(year), int(gimmen), int(gimdien))
			year=int(siemet)+ys
			tt2 = datetime.date(int(year), int(men), 1)
			t1=time.mktime(tt1.timetuple())
			t2=time.mktime(tt2.timetuple())
			dienu=int((int(t2)-int(t1))/86400)
		except:
			derr = True
#      errtext =  cgi.escape(str(sys.exc_info()[0])) + ' ' + cgi.escape(str(sys.exc_info()[1])) + ' ' + cgi.escape(str(sys.exc_info()[2]))
#      req.response.out.write(errtext)
#      sys.exit(0)
		if derr:
			dienu=0


		ref=False
		if 'HTTP_REFERER' in os.environ:
			for referer in referers:
				pos = os.environ['HTTP_REFERER'].find(referer) # The offset is optional
				if not(pos < 0): # not found
					ref = True
		else:
			ref = True

		if not ref:
      #if uselog:
       #log()
			width = 256
			height = 256
			im = PNGCanvas(256, 256, [255, 255,255,255])
			im.color = [0xff,0,0,0xff]
			im.rectangle(0,0,width-1,height-1)
			im.verticalGradient(1,1,width-2, height-2,[0xff,0,0,0xff],[0x20,0,0xff,0x80])
			im.color = [0,0,0,0xff]
			im.line(0,0,width-1,height-1)
			im.line(0,0,width/2,height-1)
			im.line(0,0,width-1,height/2)
			im.copyRect(1,1,width/2-1,height/2-1,0,height/2,im)
			im.blendRect(1,1,width/2-1,height/2-1,width/2,0,im)
			str = "Bad referer"
			y = 5
			x = 256 / 2 - len(str) * 9 / 2
			x = "%u" % x
			font=GDFont()
			font.load( 'giant_w57.gd','gdfonts')
			im=GDFont.gdfontstring(font,im,str,x,y,[0, 0, 0, 0xff])
		else:
			zerr=False
			im = False
		try:
			directory = os.path.dirname(__file__)
			path = os.path.join(directory, os.path.join('gdfonts', bio_new))
			imghex=file(path,'rb').read()
			f = cStringIO.StringIO(imghex)
			im = PNGCanvas(256, 256, [0, 0,0,0])
			im.load(f)
		except:
			zerr = True
		if zerr:
#        im = PNGCanvas(256, 256, [0, 0,0,0])
			im = PNGCanvas(256, 256, color1)
		zerr=True
		str = strbio
		y = 10
		x = 256 / 2 - len(str) * 9 / 2
		x = "%u" % x
		font5=GDFont()
		font5.load( 'giant_w57.gd','gdfonts')
		font4=GDFont()
		font4.load( 'large_w57.gd','gdfonts')
		font3=GDFont()
		font3.load( 'medium_w57.gd','gdfonts')
		font2=GDFont()
		font2.load( 'small_w57.gd','gdfonts')
		font1=GDFont()
		font1.load( 'tiny_w57.gd','gdfonts')
		if zerr:
			im=GDFont.gdfontstring(font5,im,str,x,y,color2)
		str = strfiz
		y = 130 + 10
		x = 256 / 2 - len(str) * 6 / 2
		x = "%u" % x
		if zerr:
			im=GDFont.gdfontstring(font2,im,str,x,y,color3)
		str = stremo
		y = 130 + 10 + 5 + 12
		x = 256 / 2 - len(str) * 6 / 2
		x = "%u" % x
		if zerr:
			im=GDFont.gdfontstring(font2,im,str,x,y,color4)
		str = strint
		y = 130 + 10 + 5 + 12 + 5 + 12
		x = 256 / 2 - len(str) * 6 / 2
		x = "%u" % x
		if zerr:
			im=GDFont.gdfontstring(font2,im,str,x,y,color5)
		str = strmd
		y = 82 + 4 + 8 + 4
		x = 256 / 2 - len(str) * 5 / 2
		x = "%u" % x
		if zerr:
			im=GDFont.gdfontstring(font1,im,str,x,y,color2)
		str = strid+':'
		y = 130 + 10 + 5 + 12 + 5 + 12 + 5 + 12
		x = 256 / 2 - len(str) * 6
		x = "%u" % x
		if zerr:
			im=GDFont.gdfontstring(font2,im,str,x,y,color2)
		str = " %s" % dienu
		y = 130 + 10 + 5 + 12 + 5 + 12 + 5 + 12
		x = 256 / 2
		x = "%u" % x
		im=GDFont.gdfontstring(font2,im,str,x,y,color2)
		str = strgd+':'
		y = 130 + 10 + 5 + 12 + 5 + 12 + 5 + 12 + 8 + 12
		x = 256 / 2 - len(str) * 7
		x = "%u" % x
		if zerr:
			im=GDFont.gdfontstring(font3,im,str,x,y,color2)
		str = " %s/%s/%s" % (gimmet, gimmen, gimdien)
		y = 130 + 10 + 5 + 12 + 5 + 12 + 5 + 12 + 8 + 12
		x = 256 / 2
		x = "%u" % x
		im=GDFont.gdfontstring(font3,im,str,x,y,color2)
		str = strm+':'
		y = 130 + 10 + 5 + 12 + 5 + 12 + 5 + 12 + 8 + 12 + 6 + 13
		x = 256 / 2 - len(str) * 7
		x = "%u" % x
		if zerr:
			im=GDFont.gdfontstring(font3,im,str,x,y,color2)
		str = " %s/%s" % (siemet,men)
		y = 130 + 10 + 5 + 12 + 5 + 12 + 5 + 12 + 8 + 12 + 6 + 13
		x = 256 / 2
		x = "%u" % x
		im=GDFont.gdfontstring(font3,im,str,x,y,color2)
		prad = 10
		gal = 256 - prad
		im.color = color2
		im.line(prad,80,gal,80)
		ii = ilg[int(men)]
		if int(men) == 2 and int(int(siemet) % 4) == 0:
			ii+=1
		y = 82 + 4
		str = 1
		x = prad - len("%s" % str) * 5 / 2
		x = "%u" % x
		im=GDFont.gdfontstring(font1,im,str,x,y,color2)
		for i in range(5, ii, 5):
			str = i
			x = prad + (i - 1) * (256 - prad - prad) / (ii - 1)
			x = x - len("%s" % str) * 5 / 2
			x = "%u" % x
			im=GDFont.gdfontstring(font1,im,str,x,y,color2)
		pi = math.pi
		x = prad
		xsen = "%u" % x
		y = 80 - 50 * math.sin((1 + dienu) * 2 * pi / cikfiz)
		yfiz = "%u" % y
		y = 80 - 50 * math.sin((1 + dienu) * 2 * pi / cikemo)
		yemo = "%u" % y
		y = 80 - 50 * math.sin((1 + dienu) * 2 * pi / cikint)
		yint = "%u" % y
		for i in range(1, ii):
			x = prad + (i - 1) * (256 - prad - prad) / (ii - 1)
			x = "%u" % x
			im.color = color2
			im.line(x,78,x,82)
			y = 80 - 50 * math.sin((i + dienu) * 2 * pi / cikfiz)
			y = "%u" % y
			im.color = color3
			im.line(xsen,yfiz,x,y)
			yfiz = y
			y = 80 - 50 * math.sin((i + dienu) * 2 * pi / cikemo)
			y = "%u" % y
			im.color = color4
			im.line(xsen,yemo,x,y)
			yemo = y
			y = 80 - 50 * math.sin((i + dienu) * 2 * pi / cikint)
			y = "%u" % y
			im.color = color5
			im.line(xsen,yint,x,y)
			yint = y
			xsen = x

		sgimmet = "%04d" % int(gimmet)
		sgimmen =  "%02d" % int(gimmen)
		sgimdien =  "%02d" % int(gimdien)


		gimd=sgimmet+sgimmen+sgimdien
		expiration = datetime.datetime.now() + timedelta(seconds=3600*24*90)
		exp=expiration.strftime("%a, %d-%b-%Y %H:%M:%S PST")
		req.response.headers['Content-Type'] = "image/png"
		req.response.headers['Set-Cookie'] = "terebasGimd=%s; path=/; expires=%s" % (gimd,exp)
		req.response.out.write(im.dump())
Esempio n. 10
0
def plot_error(results, args):
   im = PNGCanvas(40, 15)
   im.color = rgb.colors('red')
   im.line(0, 0, im.width-1, im.height-1)
   im.line(0, im.height-1, im.width-1, 0)
   return im.dump()