Skip to content

Commit

Permalink
Re-export loader factories in top-level package.
Browse files Browse the repository at this point in the history
  • Loading branch information
jg-rp committed Feb 7, 2024
1 parent 04288a9 commit 45fd61b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
6 changes: 3 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

**Fixes**

- Fixed a bug with the LRU cache. We now raise a `ValueError` at construction time if a caching template loader is given a cache size less than 1. Previously, in such cases, an `IndexError` would have been raised when attempting to write to the cache.
- Fixed a bug with the LRU cache. We now raise a `ValueError` at construction time if a caching template loader is given a cache size less than 1. Previously, in such cases, an `IndexError` would have been raised when attempting to write to the cache. See [#148](https://github.com/jg-rp/liquid/issues/148).

**Features**

- Added `make_choice_loader()`, a factory function that returns a `ChoiceLoader` or `CachingChoiceLoader` depending on its arguments.
- Added `make_file_system_loader()`, a factory function that returns a `FileSystemLoader`, `FileExtensionLoader` or `CachingFileSystemLoader` depending on its arguments.
- Added `make_choice_loader()`, a factory function that returns a `ChoiceLoader` or `CachingChoiceLoader` depending on its arguments. ([docs](https://jg-rp.github.io/liquid/api/make-choice-loader))
- Added `make_file_system_loader()`, a factory function that returns a `FileSystemLoader`, `FileExtensionLoader` or `CachingFileSystemLoader` depending on its arguments. ([docs](https://jg-rp.github.io/liquid/api/make-file-system-loader))

## Version 1.11.0

Expand Down
4 changes: 4 additions & 0 deletions liquid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from .loaders import FileExtensionLoader
from .loaders import FileSystemLoader
from .loaders import PackageLoader
from .loaders import make_choice_loader
from .loaders import make_file_system_loader

from .context import Context
from .context import DebugUndefined
Expand Down Expand Up @@ -67,6 +69,8 @@
"FutureBoundTemplate",
"FutureContext",
"is_undefined",
"make_choice_loader",
"make_file_system_loader",
"Markup",
"Mode",
"PackageLoader",
Expand Down
16 changes: 8 additions & 8 deletions tests/test_template_loader_factories.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""Template loader factory test cases."""
import unittest

from liquid.loaders import CachingChoiceLoader
from liquid.loaders import CachingFileSystemLoader
from liquid.loaders import ChoiceLoader
from liquid.loaders import DictLoader
from liquid.loaders import FileExtensionLoader
from liquid.loaders import FileSystemLoader
from liquid.loaders import make_choice_loader
from liquid.loaders import make_file_system_loader
from liquid import CachingChoiceLoader
from liquid import CachingFileSystemLoader
from liquid import ChoiceLoader
from liquid import DictLoader
from liquid import FileExtensionLoader
from liquid import FileSystemLoader
from liquid import make_choice_loader
from liquid import make_file_system_loader


class TemplateLoaderFactoryTestCase(unittest.TestCase):
Expand Down

0 comments on commit 45fd61b

Please sign in to comment.