Skip to content

Commit

Permalink
🩹 Fix file loading
Browse files Browse the repository at this point in the history
  • Loading branch information
s-weigand committed Jan 6, 2023
1 parent ba956d6 commit 29d3dc5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions glotaran/project/project_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ def load_item(self, name: str) -> Any:
ValueError
Raise if the item does not exist.
"""
try:
path = next(p for p in self._directory.iterdir() if name in p.name)
except StopIteration as e:
raise ValueError(f"No Item with name '{name}' exists.") from e
return self._loader(path)
if name in self.items:
return self._loader(self.items[name])
raise ValueError(
f"No Item with name '{name}' exists. Known items are: {self.items.keys()}"
)

def markdown(self, join_indentation: int = 0) -> MarkdownStr:
"""Format the registry items as a markdown text.
Expand Down

0 comments on commit 29d3dc5

Please sign in to comment.