Exemplo n.º 1
0
  def get_template(self, uri):
    app = apputil.get_current_app()
    if not app:
      raise Exception("no app!")

    real_loader = self._get_loader(app)
    return real_loader.get_template(uri)
Exemplo n.º 2
0
    def get_template(self, uri):
        app = apputil.get_current_app()
        if not app:
            raise Exception("no app!")

        real_loader = self._get_loader(app)
        return real_loader.get_template(uri)
Exemplo n.º 3
0
def load_template_source(name, dirs=[]):
  app = apputil.get_current_app()
  if not app:
    logging.info("No app found while loading template %s" % name)
    raise TemplateDoesNotExist("No app: " + name)
  if app in APP_REMAP:
    app = APP_REMAP[app]
  # We can import the app, and then find it in sys.modules,
  # thereby, in cases of "a.b.c", finding the whole thing, and not
  # just "a".
  __import__(app)
  app_module = sys.modules[app]
  app_dir = os.path.dirname(app_module.__file__)
  default_dir = os.path.join(app_dir, 'templates')

  return app_directories.load_template_source(name, [default_dir])
Exemplo n.º 4
0
def load_template_source(name, dirs=[]):
    app = apputil.get_current_app()
    if not app:
        logging.info("No app found while loading template %s" % name)
        raise TemplateDoesNotExist("No app: " + name)
    if app in APP_REMAP:
        app = APP_REMAP[app]
    # We can import the app, and then find it in sys.modules,
    # thereby, in cases of "a.b.c", finding the whole thing, and not
    # just "a".
    __import__(app)
    app_module = sys.modules[app]
    app_dir = os.path.dirname(app_module.__file__)
    default_dir = os.path.join(app_dir, 'templates')

    return app_directories.load_template_source(name, [default_dir])