1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Move extras.jinja2.ConfigTemplateLoader to utilities.jinja2.DataFileLoader

This commit is contained in:
Jeremy Stretch
2024-03-21 13:19:12 -04:00
parent b2e03805ab
commit c30d22335a
2 changed files with 4 additions and 4 deletions

View File

@ -7,12 +7,12 @@ from django.utils.translation import gettext_lazy as _
from jinja2.loaders import BaseLoader
from jinja2.sandbox import SandboxedEnvironment
from extras.jinja2 import ConfigTemplateLoader
from extras.querysets import ConfigContextQuerySet
from netbox.config import get_config
from netbox.registry import registry
from netbox.models import ChangeLoggedModel
from netbox.models.features import CloningMixin, CustomLinksMixin, ExportTemplatesMixin, SyncedDataMixin, TagsMixin
from utilities.jinja2 import DataFileLoader
from utilities.utils import deepmerge
__all__ = (
@ -290,7 +290,7 @@ class ConfigTemplate(SyncedDataMixin, CustomLinksMixin, ExportTemplatesMixin, Ta
"""
# Initialize the template loader & cache the base template code (if applicable)
if self.data_file:
loader = ConfigTemplateLoader(data_source=self.data_source)
loader = DataFileLoader(data_source=self.data_source)
loader.cache_templates({
self.data_file.path: self.template_code
})

View File

@ -3,11 +3,11 @@ from jinja2 import BaseLoader, TemplateNotFound
from jinja2.meta import find_referenced_templates
__all__ = (
'ConfigTemplateLoader',
'DataFileLoader',
)
class ConfigTemplateLoader(BaseLoader):
class DataFileLoader(BaseLoader):
"""
Custom Jinja2 loader to facilitate populating template content from DataFiles.
"""