(self, key: str)
| 293 | path = r"(/works/OL\d+W|/books/OL\d+M)/widget" |
| 294 | |
| 295 | def GET(self, key: str): # type: ignore[override] |
| 296 | olid = key.rsplit("/", maxsplit=1)[-1] |
| 297 | item = web.ctx.site.get(key) |
| 298 | is_work = key.startswith("/works/") |
| 299 | item["olid"] = olid |
| 300 | item["availability"] = get_availability( |
| 301 | "openlibrary_work" if is_work else "openlibrary_edition", |
| 302 | [olid], |
| 303 | ).get(olid) |
| 304 | item["authors"] = [web.storage(key=a.key, name=a.name or None) for a in item.get_authors()] |
| 305 | return delegate.RawText( |
| 306 | render_template("widget", format_work_data(item) if is_work else item), |
| 307 | content_type="text/html", |
| 308 | ) |
| 309 | |
| 310 | |
| 311 | def format_work_data(work): |
nothing calls this directly
no test coverage detected