Skip to content

Commit

Permalink
Check for substituted_label
Browse files Browse the repository at this point in the history
  • Loading branch information
KJhellico committed Jul 20, 2023
1 parent 96eefc0 commit 7f47459
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions holidays/holiday_base.py
Expand Up @@ -565,9 +565,11 @@ def _add_subdiv_holidays(self):

def _add_substituted_holidays(self):
"""Populate substituted holidays."""
substituted_label = self.tr(
getattr(self, "substituted_label", "Day off (substituted from %s)")
)
if len(self.substituted_holidays) == 0:
return None
if not hasattr(self, "substituted_label"):
raise ValueError(f"Country `{self.country}` class should contain `substituted_label`")
substituted_label = self.tr(self.substituted_label)
substituted_date_format = self.tr(getattr(self, "substituted_date_format", "%d.%m.%Y"))
for hol in _normalize_tuple(self.substituted_holidays.get(self._year, ())):
from_year = hol[0] if len(hol) == 5 else self._year
Expand Down

0 comments on commit 7f47459

Please sign in to comment.