当前位置: 首页>>代码示例>>Python>>正文


Python CssAbsoluteFilter.input方法代码示例

本文整理汇总了Python中compressor.filters.css_default.CssAbsoluteFilter.input方法的典型用法代码示例。如果您正苦于以下问题:Python CssAbsoluteFilter.input方法的具体用法?Python CssAbsoluteFilter.input怎么用?Python CssAbsoluteFilter.input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在compressor.filters.css_default.CssAbsoluteFilter的用法示例。


在下文中一共展示了CssAbsoluteFilter.input方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_css_absolute_filter_only_url_fragment

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
    def test_css_absolute_filter_only_url_fragment(self):
        filename = os.path.join(settings.COMPRESS_ROOT, 'css/url/test.css')
        content = "p { background: url('#foo') }"
        filter = CssAbsoluteFilter(content)
        self.assertEqual(content, filter.input(filename=filename, basename='css/url/test.css'))

        with self.settings(COMPRESS_URL='http://media.example.com/'):
            filter = CssAbsoluteFilter(content)
            self.assertEqual(content, filter.input(filename=filename, basename='css/url/test.css'))
开发者ID:AaronGhent,项目名称:django-compressor,代码行数:11,代码来源:test_filters.py

示例2: test_css_absolute_filter_relative_path

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
 def test_css_absolute_filter_relative_path(self):
     from compressor.filters.css_default import CssAbsoluteFilter
     filename = os.path.join(django_settings.TEST_DIR, 'whatever', '..', 'media', 'whatever/../css/url/test.css')
     content = "p { background: url('../../images/image.gif') }"
     output = "p { background: url('%simages/image.gif?%s') }" % (settings.MEDIA_URL, get_hashed_mtime(filename))
     filter = CssAbsoluteFilter(content)
     self.assertEqual(output, filter.input(filename=filename))
     settings.MEDIA_URL = 'https://media.example.com/'
     output = "p { background: url('%simages/image.gif?%s') }" % (settings.MEDIA_URL, get_hashed_mtime(filename))
     self.assertEqual(output, filter.input(filename=filename))
开发者ID:wesleyfr,项目名称:django_compressor,代码行数:12,代码来源:tests.py

示例3: test_css_absolute_filter_relative_path

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
 def test_css_absolute_filter_relative_path(self):
     filename = os.path.join(settings.TEST_DIR, 'whatever', '..', 'media', 'whatever/../css/url/test.css')
     imagefilename = os.path.join(settings.COMPRESS_ROOT, 'img/python.png')
     output = "p { background: url('%simg/python.png?%s') }" % (settings.COMPRESS_URL, self.hashing_func(imagefilename))
     filter = CssAbsoluteFilter(self.content)
     self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
     settings.COMPRESS_URL = 'https://media.example.com/'
     filter = CssAbsoluteFilter(self.content)
     output = "p { background: url('%simg/python.png?%s') }" % (settings.COMPRESS_URL, self.hashing_func(imagefilename))
     self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
开发者ID:aeggermont,项目名称:mobileDev,代码行数:12,代码来源:filters.py

示例4: test_css_absolute_filter_https

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
 def test_css_absolute_filter_https(self):
     from compressor.filters.css_default import CssAbsoluteFilter
     filename = os.path.join(settings.MEDIA_ROOT, 'css/url/test.css')
     content = "p { background: url('../../images/image.gif') }"
     output = "p { background: url('%simages/image.gif') }" % settings.MEDIA_URL
     filter = CssAbsoluteFilter(content)
     self.assertEqual(output, filter.input(filename=filename))
     settings.MEDIA_URL = 'https://media.example.com/'
     filename = os.path.join(settings.MEDIA_ROOT, 'css/url/test.css')
     output = "p { background: url('%simages/image.gif') }" % settings.MEDIA_URL
     self.assertEqual(output, filter.input(filename=filename))
开发者ID:fgallina,项目名称:wethemen,代码行数:13,代码来源:tests.py

示例5: test_css_absolute_filter

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
 def test_css_absolute_filter(self):
     from compressor.filters.css_default import CssAbsoluteFilter
     filename = os.path.join(settings.COMPRESS_ROOT, 'css/url/test.css')
     content = "p { background: url('../../images/image.gif') }"
     output = "p { background: url('%simages/image.gif?%s') }" % (settings.COMPRESS_URL, get_hashed_mtime(filename))
     filter = CssAbsoluteFilter(content)
     self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
     settings.COMPRESS_URL = 'http://media.example.com/'
     filename = os.path.join(settings.COMPRESS_ROOT, 'css/url/test.css')
     output = "p { background: url('%simages/image.gif?%s') }" % (settings.COMPRESS_URL, get_hashed_mtime(filename))
     self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
开发者ID:hvdklauw,项目名称:django_compressor,代码行数:13,代码来源:tests.py

示例6: test_css_absolute_filter_relative_path

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
 def test_css_absolute_filter_relative_path(self):
     from compressor.filters.css_default import CssAbsoluteFilter
     filename = os.path.join(settings.TEST_DIR, 'whatever', '..', 'media', 'whatever/../css/url/test.css')
     imagefilename = os.path.join(settings.COMPRESS_ROOT, 'img/python.png')
     content = "p { background: url('../../img/python.png') }"
     output = "p { background: url('%simg/python.png?%s') }" % (settings.COMPRESS_URL, self.suffix_method(imagefilename))
     filter = CssAbsoluteFilter(content)
     self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
     settings.COMPRESS_URL = 'https://media.example.com/'
     filter = CssAbsoluteFilter(content)
     output = "p { background: url('%simg/python.png?%s') }" % (settings.COMPRESS_URL, self.suffix_method(imagefilename))
     self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
开发者ID:bfirsh,项目名称:django_compressor,代码行数:14,代码来源:filters.py

示例7: test_css_absolute_filter_filename_outside_compress_root

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
 def test_css_absolute_filter_filename_outside_compress_root(self):
     filename = '/foo/bar/baz/test.css'
     content = self.template % blankdict(url='../qux/')
     params = blankdict({
         'url': settings.COMPRESS_URL + 'bar/qux/',
     })
     output = self.template % params
     filter = CssAbsoluteFilter(content)
     self.assertEqual(output, filter.input(filename=filename, basename='bar/baz/test.css'))
     settings.COMPRESS_URL = 'https://static.example.com/'
     params['url'] = settings.COMPRESS_URL + 'bar/qux/'
     output = self.template % params
     filter = CssAbsoluteFilter(content)
     self.assertEqual(output, filter.input(filename=filename, basename='bar/baz/test.css'))
开发者ID:torchbox,项目名称:django-compressor,代码行数:16,代码来源:test_filters.py

示例8: test_css_no_hash

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
    def test_css_no_hash(self):
        filename = os.path.join(settings.COMPRESS_ROOT, 'css/url/test.css')
        content = self.template % blankdict(url='../../')
        params = blankdict({
            'url': settings.COMPRESS_URL,
        })
        output = self.template % params
        filter = CssAbsoluteFilter(content)
        self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))

        with self.settings(COMPRESS_URL='http://static.example.com/'):
            params['url'] = settings.COMPRESS_URL
            output = self.template % params
            filter = CssAbsoluteFilter(content)
            self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
开发者ID:AaronGhent,项目名称:django-compressor,代码行数:17,代码来源:test_filters.py

示例9: test_css_absolute_filter_relative_path

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
 def test_css_absolute_filter_relative_path(self):
     filename = os.path.join(settings.TEST_DIR, 'whatever', '..', 'media', 'whatever/../css/url/test.css')
     imagefilename = os.path.join(settings.COMPRESS_ROOT, 'img/python.png')
     params = {
         'url': settings.COMPRESS_URL,
         'hash': self.hashing_func(imagefilename),
     }
     output = ("p { background: url('%(url)simg/python.png?%(hash)s') }"
               "p { filter: Alpha(src='%(url)simg/python.png?%(hash)s') }") % params
     filter = CssAbsoluteFilter(self.content)
     self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
     settings.COMPRESS_URL = params['url'] = 'https://media.example.com/'
     filter = CssAbsoluteFilter(self.content)
     output = ("p { background: url('%(url)simg/python.png?%(hash)s') }"
               "p { filter: Alpha(src='%(url)simg/python.png?%(hash)s') }") % params
     self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
开发者ID:gregplaysguitar,项目名称:django_compressor,代码行数:18,代码来源:filters.py

示例10: test_css_absolute_filter_relative_path

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
    def test_css_absolute_filter_relative_path(self):
        filename = os.path.join(settings.TEST_DIR, 'whatever', '..', 'static', 'whatever/../css/url/test.css')
        imagefilename = os.path.join(settings.COMPRESS_ROOT, 'img/python.png')
        content = self.template % blankdict(url='../../')
        params = blankdict({
            'url': settings.COMPRESS_URL,
            'hash': '?' + self.hashing_func(imagefilename),
        })
        output = self.template % params
        filter = CssAbsoluteFilter(content)
        self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))

        settings.COMPRESS_URL = params['url'] = 'https://static.example.com/'
        output = self.template % params
        filter = CssAbsoluteFilter(content)
        self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
开发者ID:torchbox,项目名称:django-compressor,代码行数:18,代码来源:test_filters.py

示例11: test_css_absolute_filter_querystring

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
    def test_css_absolute_filter_querystring(self):
        filename = os.path.join(settings.COMPRESS_ROOT, 'css/url/test.css')
        imagefilename = os.path.join(settings.COMPRESS_ROOT, 'img/python.png')
        params = {
            'url': settings.COMPRESS_URL,
            'hash': self.hashing_func(imagefilename),
        }
        content = "p { background: url('../../img/python.png?foo') }"

        output = "p { background: url('%(url)simg/python.png?foo&%(hash)s') }" % params
        filter = CssAbsoluteFilter(content)
        self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
        settings.COMPRESS_URL = params['url'] = 'http://media.example.com/'
        filter = CssAbsoluteFilter(content)
        filename = os.path.join(settings.COMPRESS_ROOT, 'css/url/test.css')
        output = "p { background: url('%(url)simg/python.png?foo&%(hash)s') }" % params
        self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
开发者ID:32footsteps,项目名称:SpecialCollectionsProject,代码行数:19,代码来源:test_filters.py

示例12: test_css_absolute_filter_querystring

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
    def test_css_absolute_filter_querystring(self):
        filename = os.path.join(settings.COMPRESS_ROOT, 'css/url/test.css')
        imagefilename = os.path.join(settings.COMPRESS_ROOT, 'img/python.png')
        content = self.template % blankdict(url='../../', query='?foo')
        params = blankdict({
            'url': settings.COMPRESS_URL,
            'query': '?foo',
            'hash': '&' + self.hashing_func(imagefilename),
        })
        output = self.template % params
        filter = CssAbsoluteFilter(content)
        self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))

        settings.COMPRESS_URL = params['url'] = 'http://media.example.com/'
        output = self.template % params
        filter = CssAbsoluteFilter(content)
        self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
开发者ID:torchbox,项目名称:django-compressor,代码行数:19,代码来源:test_filters.py

示例13: test_css_absolute_filter_url_fragment

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
    def test_css_absolute_filter_url_fragment(self):
        filename = os.path.join(settings.COMPRESS_ROOT, 'css/url/test.css')
        imagefilename = os.path.join(settings.COMPRESS_ROOT, 'img/python.png')
        content = self.template % blankdict(url='../../', frag='#foo')
        params = blankdict({
            'url': settings.COMPRESS_URL,
            'hash': '?' + self.hashing_func(imagefilename),
            'frag': '#foo',
        })
        output = self.template % params
        filter = CssAbsoluteFilter(content)
        self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))

        with self.settings(COMPRESS_URL='http://media.example.com/'):
            params['url'] = settings.COMPRESS_URL
            output = self.template % params
            filter = CssAbsoluteFilter(content)
            self.assertEqual(output, filter.input(filename=filename, basename='css/url/test.css'))
开发者ID:AaronGhent,项目名称:django-compressor,代码行数:20,代码来源:test_filters.py

示例14: test_css_absolute_filter

# 需要导入模块: from compressor.filters.css_default import CssAbsoluteFilter [as 别名]
# 或者: from compressor.filters.css_default.CssAbsoluteFilter import input [as 别名]
    def test_css_absolute_filter(self):
        from compressor.filters.css_default import CssAbsoluteFilter

        filename = os.path.join(settings.COMPRESS_ROOT, "css/url/test.css")
        imagefilename = os.path.join(settings.COMPRESS_ROOT, "img/python.png")
        content = "p { background: url('../../img/python.png') }"
        output = "p { background: url('%simg/python.png?%s') }" % (
            settings.COMPRESS_URL,
            self.suffix_method(imagefilename),
        )
        filter = CssAbsoluteFilter(content)
        self.assertEqual(output, filter.input(filename=filename, basename="css/url/test.css"))
        settings.COMPRESS_URL = "http://media.example.com/"
        filter = CssAbsoluteFilter(content)
        filename = os.path.join(settings.COMPRESS_ROOT, "css/url/test.css")
        output = "p { background: url('%simg/python.png?%s') }" % (
            settings.COMPRESS_URL,
            self.suffix_method(imagefilename),
        )
        self.assertEqual(output, filter.input(filename=filename, basename="css/url/test.css"))
开发者ID:peterdocter,项目名称:django_compressor,代码行数:22,代码来源:filters.py


注:本文中的compressor.filters.css_default.CssAbsoluteFilter.input方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。