Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

locmem.py 672B

1234567891011121314151617181920212223242526
  1. """
  2. Wrapper for loading templates from a plain Python dict.
  3. """
  4. from django.template import Origin, TemplateDoesNotExist
  5. from .base import Loader as BaseLoader
  6. class Loader(BaseLoader):
  7. def __init__(self, engine, templates_dict):
  8. self.templates_dict = templates_dict
  9. super().__init__(engine)
  10. def get_contents(self, origin):
  11. try:
  12. return self.templates_dict[origin.name]
  13. except KeyError:
  14. raise TemplateDoesNotExist(origin)
  15. def get_template_sources(self, template_name):
  16. yield Origin(
  17. name=template_name,
  18. template_name=template_name,
  19. loader=self,
  20. )