コード例 #1
0
    def __get_parser(self, engine):
        if engine == "jinja2":
            from compressor.offline.jinja2 import Jinja2Parser
            env = settings.COMPRESS_JINJA2_GET_ENVIRONMENT()
            parser = Jinja2Parser(charset=settings.FILE_CHARSET, env=env)
        elif engine == "django":
            from compressor.offline.django import DjangoParser
            parser = DjangoParser(charset=settings.FILE_CHARSET)
        else:
            raise OfflineGenerationError("Invalid templating engine specified.")

        return parser
コード例 #2
0
ファイル: compilescss.py プロジェクト: Ofey521/AMP
 def get_parser(self, engine):
     if engine == 'jinja2':
         from compressor.offline.jinja2 import Jinja2Parser
         env = settings.COMPRESS_JINJA2_GET_ENVIRONMENT()
         parser = Jinja2Parser(charset='utf-8', env=env)
     elif engine == 'django':
         from compressor.offline.django import DjangoParser
         parser = DjangoParser(charset='utf-8')
     else:
         raise CommandError(
             "Invalid templating engine '{engine}' specified.".format(
                 engine=engine))
     return parser