def GET(self, key): lst = web.ctx.site.get(key) if not lst: raise web.notfound() format = web.input(format="html").format if format == "html": html = render_template("lists/export_as_html", lst, self.get_editions(lst)) return delegate.RawText(html) elif format == "bibtex": html = render_template("lists/export_as_bibtex", lst, self.get_editions(lst)) return delegate.RawText(html) elif format == "json": data = {"editions": self.get_editions(lst, raw=True)} web.header("Content-Type", "application/json") return delegate.RawText(formats.dump_json(data)) elif format == "yaml": data = {"editions": self.get_editions(lst, raw=True)} web.header("Content-Type", "application/yaml") return delegate.RawText(formats.dump_yaml(data)) else: raise web.notfound()