Coverage for an_website/kangaroo_comics/comics.py: 93.333%
15 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-16 19:56 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-16 19:56 +0000
1# This program is free software: you can redistribute it and/or modify
2# it under the terms of the GNU Affero General Public License as
3# published by the Free Software Foundation, either version 3 of the
4# License, or (at your option) any later version.
5#
6# This program is distributed in the hope that it will be useful,
7# but WITHOUT ANY WARRANTY; without even the implied warranty of
8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9# GNU Affero General Public License for more details.
10#
11# You should have received a copy of the GNU Affero General Public License
12# along with this program. If not, see <https://www.gnu.org/licenses/>.
14"""A page with the kangaroo comics by Zeit Online."""
16from __future__ import annotations
18from ..utils.request_handler import HTMLRequestHandler
19from ..utils.utils import ModuleInfo
22def get_module_info() -> ModuleInfo:
23 """Create and return the ModuleInfo for this module."""
24 return ModuleInfo(
25 handlers=(
26 (r"/kaenguru-comics", KangarooComicsRedirect),
27 (r"/kaenguru-comics-alt", KangarooComics),
28 ),
29 name="Känguru-Comics",
30 description=(
31 "Känguru-Comics von Zeit Online, Marc-Uwe Kling und Bernd Kissel"
32 ),
33 path="/kaenguru-comics",
34 keywords=("Känguru", "Comics", "Zeit", "Marc-Uwe Kling"),
35 aliases=(
36 "/kangaroo-comics",
37 "/comics",
38 "/känguru-comics",
39 "/k%C3%A4nguru-comics",
40 ),
41 )
44class KangarooComicsRedirect(HTMLRequestHandler):
45 """Request handler for the kangaroo comics redirect."""
47 async def get(self, *, head: bool = False) -> None:
48 """Handle GET requests to the kangaroo comics page."""
49 if head:
50 return
51 await self.render(
52 "pages/redirect.html",
53 send_referrer=False,
54 redirect_url="https://www.zeit.de/serie/die-kaenguru-comics",
55 from_url=self.fix_url("/kaenguru-comics-alt"),
56 back_button_text="Comics hier lesen (nicht empfohlen)",
57 discord=False,
58 )
61class KangarooComics(HTMLRequestHandler):
62 """Request handler for the kangaroo comics page."""
64 async def get(self, *, head: bool = False) -> None:
65 """Handle GET requests to the kangaroo comics page."""
66 if head:
67 return
68 await self.render("pages/kangaroo_comics.html")