dirigent-common 0.16.2__tar.gz → 0.16.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/PKG-INFO +1 -1
  2. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/pyproject.toml +1 -1
  3. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/pyproject.toml.orig +1 -1
  4. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/templating.py +9 -0
  5. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/LICENSE +0 -0
  6. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/README.md +0 -0
  7. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/__init__.py +0 -0
  8. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/clients.py +0 -0
  9. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/docstrings.py +0 -0
  10. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/durations.py +0 -0
  11. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/formats.py +0 -0
  12. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/formatters.py +0 -0
  13. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/names.py +0 -0
  14. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/programs.py +0 -0
  15. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/py.typed +0 -0
  16. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/schemas.py +0 -0
  17. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/sizes.py +0 -0
  18. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/types.py +0 -0
  19. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/uris.py +0 -0
  20. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/values.py +0 -0
  21. {dirigent_common-0.16.2 → dirigent_common-0.16.4}/src/dirigent_common/versions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dirigent-common
3
- Version: 0.16.2
3
+ Version: 0.16.4
4
4
  Summary: Value types and shared schemas every dirigent package may depend on.
5
5
  License-Expression: LicenseRef-Proprietary
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dirigent-common"
3
- version = "0.16.2"
3
+ version = "0.16.4"
4
4
  description = "Value types and shared schemas every dirigent package may depend on."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dirigent-common"
3
- version = "0.16.2"
3
+ version = "0.16.4"
4
4
  description = "Value types and shared schemas every dirigent package may depend on."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -126,6 +126,11 @@ def render(source: str | jinja2.Template, context: Mapping[str, Any], *, max_byt
126
126
 
127
127
  The cap is enforced as the text is generated, so a runaway loop stops at the cap rather
128
128
  than after it has built the whole string.
129
+
130
+ Anything a template does while it renders -- dividing by zero, a filter refusing what it
131
+ was handed, a macro that recurses, an object in the context that raises when it is read --
132
+ leaves as a ``TemplateError``, so text that could not be produced never takes down the
133
+ work that asked for it.
129
134
  """
130
135
  template = compile_template(source) if isinstance(source, str) else source
131
136
  chunks: list[str] = []
@@ -136,6 +141,8 @@ def render(source: str | jinja2.Template, context: Mapping[str, Any], *, max_byt
136
141
  size += len(chunk.encode())
137
142
  if size > max_bytes:
138
143
  raise RenderTooLarge(max_bytes)
144
+ except RenderTooLarge:
145
+ raise
139
146
  except (jinja2.TemplateNotFound, jinja2.TemplatesNotFound) as error:
140
147
  raise TemplateError(f"no template named {error.message}: a template cannot pull in another") from error
141
148
  except (jinja2.UndefinedError, jinja2.exceptions.SecurityError) as error:
@@ -145,4 +152,6 @@ def render(source: str | jinja2.Template, context: Mapping[str, Any], *, max_byt
145
152
  if "no loader" in str(error):
146
153
  raise TemplateError("a template cannot include, import or extend another") from error
147
154
  raise TemplateError(str(error)) from error
155
+ except Exception as error:
156
+ raise TemplateError(f"{type(error).__name__}: {error}") from error
148
157
  return "".join(chunks)