Skip to content

Commit

Permalink
Upgrade to Betty 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfeenstra committed Jun 28, 2024
1 parent 460c2a8 commit 1c57f8f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions ancestry/extension/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import logging
from typing import override

from betty.app.extension import Extension, UserFacingExtension
from betty.cli import CommandProvider
from betty.extension import Privatizer
from betty.load import PostLoader, getLogger
from betty.load import PostLoader
from betty.locale import Str, DEFAULT_LOCALIZER
from betty.model.ancestry import (
PersonName,
Expand Down Expand Up @@ -63,7 +64,8 @@ async def post_load(self) -> None:
self._publish_files()

def _publish_people(self):
getLogger().info("Publishing selected people...")
logger = logging.getLogger("betty")
logger.info("Publishing selected people...")
for person_id, (individual_name, affiliation_name) in _PEOPLE.items():
person = self._app.project.ancestry[Person][person_id]
person.public = True
Expand All @@ -74,12 +76,11 @@ def _publish_people(self):
public=True,
)
self._app.project.ancestry.add(person_name)
getLogger().info(
f"Published {person_name.label.localize(DEFAULT_LOCALIZER)}"
)
logger.info(f"Published {person_name.label.localize(DEFAULT_LOCALIZER)}")

def _publish_bart(self):
getLogger().info("Publishing Bart...")
logger = logging.getLogger("betty")
logger.info("Publishing Bart...")
bart = self._app.project.ancestry[Person]["I0000"]
netherlands = self._app.project.ancestry[Place]["P0052"]
birth = Event(
Expand All @@ -95,8 +96,9 @@ def _publish_bart(self):
presence.event.public = True

def _publish_files(self):
getLogger().info("Publishing selected files...")
logger = logging.getLogger("betty")
logger.info("Publishing selected files...")
for file_id in _FILES:
file = self._app.project.ancestry[File][file_id]
file.public = True
getLogger().info(f"Published {file.label.localize(DEFAULT_LOCALIZER)}")
logger.info(f"Published {file.label.localize(DEFAULT_LOCALIZER)}")
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ authors = [
]
requires-python = '~= 3.11'
dependencies = [
'betty == 0.3.7',
'betty == 0.4.0a1',
'click ~= 8.1, >= 8.1.2',
]

Expand Down

0 comments on commit 1c57f8f

Please sign in to comment.