예제 #1
0
 def GET(self, path):
     shortener = Shortener()
     click_info = ClickInfo()
     url = shortener.get_url(path)
     if url:
         click_info.save_click(web.ctx.env, path)
         web.redirect(shortener.format_url(url['url']))
     web.notfound 
예제 #2
0
 def GET(self, code):
     shortener = Shortener()
     url = shortener.get_url(code)
     if url:
         img = qrcode.make(shortener.format_url(server_name+url['code']))
         file = cStringIO.StringIO() 
         img.save(file, 'png')
         image_code = file.getvalue()
         file.close()
         return image_code
     return ''