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
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 ''