Skip to content

Commit

Permalink
Jinja loaders: raise instead of returning None
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Dec 6, 2024
1 parent 6c75a85 commit 5007d6a
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions course/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,10 +965,7 @@ def __init__(self, repo: Repo_ish, commit_sha: bytes) -> None:
self.commit_sha = commit_sha

def __call__(self, template):
try:
data = get_repo_blob_data_cached(self.repo, template, self.commit_sha)
except ObjectDoesNotExist:
return None
data = get_repo_blob_data_cached(self.repo, template, self.commit_sha)

return data.decode("utf-8")

Expand All @@ -995,11 +992,8 @@ def __init__(self, root):
self.root = root

def __call__(self, template):
try:
with open(os.path.join(self.root, template)) as inf:
source = inf.read()
except FileNotFoundError:
return None
with open(os.path.join(self.root, template)) as inf:
source = inf.read()

_, ext = os.path.splitext(template)
ext = ext.lower()
Expand Down

0 comments on commit 5007d6a

Please sign in to comment.