From ffc5e7f7217780e01b023e1bbe89c4402bfb9196 Mon Sep 17 00:00:00 2001 From: Bart Feenstra Date: Mon, 6 May 2024 22:17:41 +0100 Subject: [PATCH] Deprecate betty.functools.walk() (#1459) --- betty/extension/cotton_candy/__init__.py | 5 +- .../templates/entity/featured--place.html.j2 | 2 +- .../templates/entity/page--person.html.j2 | 4 +- .../templates/entity/page--place.html.j2 | 2 +- .../templates/entity/page--source.html.j2 | 2 +- betty/functools.py | 5 ++ betty/model/ancestry.py | 27 +++++++- betty/privatizer.py | 3 +- betty/tests/model/test_ancestry.py | 58 ++++++++++++++++ betty/tests/test_functools.py | 67 ++++++++++--------- betty/tests/test_jinja2.py | 16 +++-- documentation/usage/templating/filters.rst | 1 - 12 files changed, 143 insertions(+), 49 deletions(-) diff --git a/betty/extension/cotton_candy/__init__.py b/betty/extension/cotton_candy/__init__.py index 536f41b90..39a08afa8 100644 --- a/betty/extension/cotton_candy/__init__.py +++ b/betty/extension/cotton_candy/__init__.py @@ -18,7 +18,6 @@ from betty.config import Configuration from betty.extension.cotton_candy.search import Index from betty.extension.webpack import Webpack, WebpackEntrypointProvider -from betty.functools import walk from betty.gui import GuiBuilder from betty.html import CssProvider from betty.jinja2 import ( @@ -427,9 +426,9 @@ def _person_timeline_events(person: Person, lifetime_threshold: int) -> Iterable is_public, ( # All ancestors. - *walk(person, "parents"), + *person.ancestors, # All descendants. - *walk(person, "children"), + *person.descendants, # All siblings. *person.siblings, ), diff --git a/betty/extension/cotton_candy/assets/templates/entity/featured--place.html.j2 b/betty/extension/cotton_candy/assets/templates/entity/featured--place.html.j2 index b2b15a386..5794b8b33 100644 --- a/betty/extension/cotton_candy/assets/templates/entity/featured--place.html.j2 +++ b/betty/extension/cotton_candy/assets/templates/entity/featured--place.html.j2 @@ -17,7 +17,7 @@