File: _internal.py

package info (click to toggle)
python-minijinja 2.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 232 kB
  • sloc: python: 525; makefile: 40; sh: 30
file content (16 lines) | stat: -rw-r--r-- 558 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# This file contains functions that the rust module imports.
from . import TemplateError, safe


def make_error(info):
    # Internal utility function used by the rust binding to create a template error
    # with info object.  We cannot directly create an error on the Rust side because
    # we want to subclass the runtime error, but on the limited abi it's not possible
    # to create subclasses (yet!)
    err = TemplateError(info.description)
    err._info = info
    return err


# used by the rust runtime to mark something as safe
mark_safe = safe