Coverage for an_website/kangaroo_comics/comics.py: 92.857%

14 statements  

« prev     ^ index     » next       coverage.py v7.14.1, created at 2026-06-10 18: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/>. 

13 

14"""A page with the kangaroo comics by Zeit Online.""" 

15 

16from ..utils.request_handler import HTMLRequestHandler 

17from ..utils.utils import ModuleInfo 

18 

19 

20def get_module_info() -> ModuleInfo: 

21 """Create and return the ModuleInfo for this module.""" 

22 return ModuleInfo( 

23 handlers=( 

24 (r"/kaenguru-comics", KangarooComicsRedirect), 

25 (r"/kaenguru-comics-alt", KangarooComics), 

26 ), 

27 name="Känguru-Comics", 

28 description=( 

29 "Känguru-Comics von Zeit Online, Marc-Uwe Kling und Bernd Kissel" 

30 ), 

31 path="/kaenguru-comics", 

32 keywords=("Känguru", "Comics", "Zeit", "Marc-Uwe Kling"), 

33 aliases=( 

34 "/kangaroo-comics", 

35 "/comics", 

36 "/känguru-comics", 

37 "/k%C3%A4nguru-comics", 

38 ), 

39 ) 

40 

41 

42class KangarooComicsRedirect(HTMLRequestHandler): 

43 """Request handler for the kangaroo comics redirect.""" 

44 

45 async def get(self, *, head: bool = False) -> None: 

46 """Handle GET requests to the kangaroo comics page.""" 

47 if head: 

48 return 

49 await self.render( 

50 "pages/redirect.html", 

51 send_referrer=False, 

52 redirect_url="https://www.zeit.de/serie/die-kaenguru-comics", 

53 from_url=self.fix_url("/kaenguru-comics-alt"), 

54 back_button_text="Comics hier lesen (nicht empfohlen)", 

55 discord=False, 

56 ) 

57 

58 

59class KangarooComics(HTMLRequestHandler): 

60 """Request handler for the kangaroo comics page.""" 

61 

62 async def get(self, *, head: bool = False) -> None: 

63 """Handle GET requests to the kangaroo comics page.""" 

64 if head: 

65 return 

66 await self.render("pages/kangaroo_comics.html")