Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a mechanism for easily loading third party template tag libraries #327

Open
lunkwill42 opened this issue Dec 12, 2023 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@lunkwill42
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

We constantly find ourselves writing new template tags to make our template logic more concise. Some of these functions are accepted upstream, while some of them are very specific to our own setup and do not belong upstream.

Currently, we need to patch CNaaS-NMS locally to add our own template tags, which becomes rather tedious every time we need to do it, or every time we need to upgrade CNaaS-NMS.

Describe the solution you'd like

It would be much better if there was a mechanism or option to configure a list of third party Python modules with template tag functions, to import at runtime and make available when rendering Jinja2 templates.

Describe alternatives you've considered

Keep using the tedious manual patch management.

@lunkwill42
Copy link
Collaborator Author

IIRC, at some point I discussed with @indy-independence the option of just manipulating the Python environment to preload our own modules. Importing a module with tags made especially for CNaaS-NMS is enough, as these modules use CNaaS-NMS decorators to register the functions as tags to be made available to Jinja2 templates.

@lunkwill42 lunkwill42 added the enhancement New feature or request label Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant