Skip to content

Commit

Permalink
Change lat, lon properties to return None
Browse files Browse the repository at this point in the history
Slight code simplification, allowing get() to
return None when the field is missing. The related
if statement in Jinja2 accepts None as False.

Co-authored-by: Simon Conseil <[email protected]>
  • Loading branch information
stasinos and saimn committed Nov 19, 2024
1 parent 3631241 commit 664fd0a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sigal/gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,13 @@ def _get_markdown_metadata(self):

@cached_property
def lat(self):
return self.markdown_metadata.get("lat", {})
"""If not `None`, latitude extracted from the Markdown index.md file."""
return self.markdown_metadata.get("lat")

@cached_property
def lon(self):
"""Other metadata extracted from the Markdown index.md file."""
return self.markdown_metadata.get("lon", {})
"""If not `None`, longitude extracted from the Markdown index.md file."""
return self.markdown_metadata.get("lon")

Check warning on line 298 in src/sigal/gallery.py

View check run for this annotation

Codecov / codecov/patch

src/sigal/gallery.py#L298

Added line #L298 was not covered by tests

@cached_property
def raw_exif(self):
Expand Down

0 comments on commit 664fd0a

Please sign in to comment.