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


Python helpers.get_module_class函数代码示例

本文整理汇总了Python中sorl.thumbnail.helpers.get_module_class函数的典型用法代码示例。如果您正苦于以下问题:Python get_module_class函数的具体用法?Python get_module_class怎么用?Python get_module_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setUp

    def setUp(self):
        self.backend = get_module_class(settings.THUMBNAIL_BACKEND)()
        self.engine = get_module_class(settings.THUMBNAIL_ENGINE)()
        self.kvstore = get_module_class(settings.THUMBNAIL_KVSTORE)()

        if not os.path.exists(settings.MEDIA_ROOT):
            os.makedirs(settings.MEDIA_ROOT)

        # portrait
        name = 'portrait.jpg'
        fn = pjoin(settings.MEDIA_ROOT, name)
        im = Image.new('L', (100, 200))
        im.paste(255, (0, 0, 100, 100))
        im.save(fn)
        self.portrait = ImageFile(Item.objects.get_or_create(image=name)[0].image)
        self.kvstore.delete(self.portrait)

        # landscape
        name = 'landscape.jpg'
        fn = pjoin(settings.MEDIA_ROOT, name)
        im = Image.new('L', (200, 100))
        im.paste(255, (0, 0, 100, 100))
        im.save(fn)
        self.landscape = ImageFile(Item.objects.get_or_create(image=name)[0].image)
        self.kvstore.delete(self.landscape)
开发者ID:aalebedev,项目名称:sorl-thumbnail,代码行数:25,代码来源:tests.py

示例2: setUp

    def setUp(self):
        self.BACKEND = get_module_class(settings.THUMBNAIL_BACKEND)()
        self.ENGINE = get_module_class(settings.THUMBNAIL_ENGINE)()
        self.KVSTORE = get_module_class(settings.THUMBNAIL_KVSTORE)()

        if not os.path.exists(settings.MEDIA_ROOT):
            os.makedirs(settings.MEDIA_ROOT)
            shutil.copytree(settings.DATA_ROOT, DATA_DIR)

        for dimension in self.IMAGE_DIMENSIONS:
            name = '%sx%s.jpg' % dimension
            self.create_image(name, dimension)
开发者ID:JordanReiter,项目名称:sorl-thumbnail,代码行数:12,代码来源:utils.py

示例3: setUp

 def setUp(self):
     self.backend = get_module_class(settings.THUMBNAIL_BACKEND)()
     self.engine = get_module_class(settings.THUMBNAIL_ENGINE)()
     self.kvstore = get_module_class(settings.THUMBNAIL_KVSTORE)()
     if not os.path.exists(settings.MEDIA_ROOT):
         os.makedirs(settings.MEDIA_ROOT)
     dims = [(500, 500), (100, 100)]
     for dim in dims:
         name = "%sx%s.jpg" % dim
         fn = pjoin(settings.MEDIA_ROOT, name)
         im = Image.new("L", dim)
         im.save(fn)
         Item.objects.get_or_create(image=name)
开发者ID:hvdklauw,项目名称:sorl-thumbnail,代码行数:13,代码来源:tests.py

示例4: setUp

    def setUp(self):
        self.backend = get_module_class(settings.THUMBNAIL_BACKEND)()
        self.engine = get_module_class(settings.THUMBNAIL_ENGINE)()
        self.kvstore = get_module_class(settings.THUMBNAIL_KVSTORE)()

        if not os.path.exists(settings.MEDIA_ROOT):
            os.makedirs(settings.MEDIA_ROOT)
            shutil.copytree(settings.DATA_ROOT, DATA_DIR)

        dims = [(500, 500), (100, 100), (200, 100), ]

        for dim in dims:
            name = '%sx%s.jpg' % dim
            self.create_image(name, dim)
开发者ID:fladi,项目名称:sorl-thumbnail,代码行数:14,代码来源:tests.py

示例5: test_dummy_response

 def test_dummy_response(self):
     client = Client()
     response = client.get('/thumbnail-dummy/111x666/')
     engine = get_module_class(settings.THUMBNAIL_ENGINE)()
     image = engine.dummy_image(111, 666)
     raw_data = engine._get_raw_data(image, format_='PNG', quality=95)
     self.assertEqual(response.content, raw_data)
开发者ID:dokterbob,项目名称:sorl-thumbnail,代码行数:7,代码来源:tests.py

示例6: _setup

 def _setup(self):
     self._wrapped = get_module_class(settings.THUMBNAIL_BACKEND)()
开发者ID:3241966,项目名称:PMS,代码行数:2,代码来源:default.py

示例7: _setup

 def _setup(self):
     self._wrapped = get_module_class(data['storage'])()
开发者ID:SpiderOak,项目名称:sorl-thumbnail,代码行数:2,代码来源:images.py

示例8: setUp

 def setUp(self):
     self.ENGINE = get_module_class(settings.THUMBNAIL_ENGINE)()
开发者ID:DeadWisdom,项目名称:sorl-thumbnail,代码行数:2,代码来源:test_backends.py

示例9: test_encode_utf8_filenames

 def test_encode_utf8_filenames(self):
     storage = get_module_class('sorl.thumbnail.images.UrlStorage')()
     self.assertEqual(
         storage.normalize_url('El jovencito emponzoñado de whisky, qué figura exhibe'),
         'El%20jovencito%20emponzoado%20de%20whisky%2C%20qu%20figura%20exhibe'
     )
开发者ID:aalebedev,项目名称:sorl-thumbnail,代码行数:6,代码来源:tests.py

示例10: setUp

 def setUp(self):
     self.backend = get_module_class(settings.THUMBNAIL_BACKEND)()
     setattr(settings, "THUMBNAIL_DUMMY", True)
开发者ID:jonashaag,项目名称:sorl-thumbnail,代码行数:3,代码来源:tests.py

示例11: type

# coding: utf-8

from django.conf import settings
from sorl.thumbnail.helpers import get_module_class

engines = [get_module_class(engine_path)
    for engine_path in settings.SORL_ENGINES]

EngineMixin = type('EngineMixin', tuple(engines), {})
开发者ID:jjdelc,项目名称:sorl-multi-engine,代码行数:9,代码来源:__init__.py


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