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


Python base.IPersistentCoverTile类代码示例

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


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

示例1: test_interface

    def test_interface(self):
        self.assertTrue(IPersistentCoverTile.implementedBy(ListFolderContentsTile))
        self.assertTrue(verifyClass(IPersistentCoverTile, ListFolderContentsTile))

        tile = ListFolderContentsTile(None, None)
        self.assertTrue(IPersistentCoverTile.providedBy(tile))
        self.assertTrue(verifyObject(IPersistentCoverTile, tile))
开发者ID:liberiun,项目名称:liberiun.govtiles,代码行数:7,代码来源:test_listfoldercontents.py

示例2: test_interface

    def test_interface(self):
        self.assertTrue(IPersistentCoverTile.implementedBy(CarouselTile))
        self.assertTrue(verifyClass(IPersistentCoverTile, CarouselTile))

        tile = CarouselTile(None, None)
        self.assertTrue(IPersistentCoverTile.providedBy(tile))
        self.assertTrue(verifyObject(IPersistentCoverTile, tile))
开发者ID:numahell,项目名称:collective.cover,代码行数:7,代码来源:test_carousel_tile.py

示例3: test_interface

    def test_interface(self):
        self.assertTrue(IPersistentCoverTile.implementedBy(PhotoGalleryTile))
        self.assertTrue(verifyClass(IPersistentCoverTile, PhotoGalleryTile))

        tile = PhotoGalleryTile(None, None)
        self.assertTrue(IPersistentCoverTile.providedBy(tile))
        self.assertTrue(verifyObject(IPersistentCoverTile, tile))
开发者ID:plonegovbr,项目名称:brasil.gov.tiles,代码行数:7,代码来源:test_photogallery_tile.py

示例4: test_interface

    def test_interface(self):
        self.assertTrue(IPersistentCoverTile.implementedBy(BannerTile))
        self.assertTrue(verifyClass(IPersistentCoverTile, BannerTile))

        tile = BannerTile(None, None)
        self.assertTrue(IPersistentCoverTile.providedBy(tile))
        # FIXME: @property decorator on class methods makes this test fail
        #        how can we fix it?
        self.assertTrue(verifyObject(IPersistentCoverTile, tile))
开发者ID:a-pasquale,项目名称:collective.cover,代码行数:9,代码来源:test_banner_tile.py

示例5: test_interface

    def test_interface(self):
        self.assertTrue(IPersistentCoverTile.implementedBy(PersistentCoverTile))
        self.assertTrue(verifyClass(IPersistentCoverTile, PersistentCoverTile))
        # cover tiles inherit from plone.tile PersistentTile
        self.assertTrue(IPersistentTile.implementedBy(PersistentCoverTile))

        tile = PersistentCoverTile(None, None)
        self.assertTrue(IPersistentCoverTile.providedBy(tile))
        self.assertTrue(verifyObject(IPersistentCoverTile, tile))
        # cover tiles inherit from plone.tile PersistentTile
        self.assertTrue(IPersistentTile.providedBy(tile))
开发者ID:Adniel,项目名称:collective.cover,代码行数:11,代码来源:test_base_tile.py

示例6: scale

 def scale(self, fieldname=None, scale=None,
           height=None, width=None, **parameters):
     if not IPersistentCoverTile.providedBy(self.context):
         base_scales = queryMultiAdapter((self.context, self.request),
                                         name='images',
                                         default=None)
         if base_scales:
             try:
                 scale = base_scales.scale(fieldname,
                                           scale,
                                           height,
                                           width,
                                           **parameters)
             except AttributeError:
                 scale = None
             return scale
         else:
             return None
     if fieldname is None:
         fieldname = IPrimaryFieldInfo(self.context).fieldname
     if scale is not None:
         available = self.getAvailableSizes(fieldname)
         if scale not in available:
             return None
         width, height = available[scale]
     storage = AnnotationStorage(self.context, self.modified)
     info = storage.scale(factory=self.create,
                          fieldname=fieldname,
                          height=height,
                          width=width,
                          **parameters)
     if info is not None:
         info['fieldname'] = fieldname
         scale_view = ImageScale(self.context, self.request, **info)
         return scale_view.__of__(self.context)
开发者ID:collective,项目名称:collective.cover,代码行数:35,代码来源:scaling.py

示例7: modified

    def modified(self):
        """ provide a callable to return the modification time of content
            items, so stored image scales can be invalidated """
        if not IPersistentCoverTile.providedBy(self.context):
            base_scales = queryMultiAdapter((self.context, self.request),
                                            name='images',
                                            default=None)
            return base_scales and base_scales.modified()
        mtime = None
        for k, v in self.context.data.items():
            if INamedImage.providedBy(v):
                mtime = self.context.data.get('{0}_mtime'.format(k), None)

        return mtime
开发者ID:collective,项目名称:collective.cover,代码行数:14,代码来源:scaling.py

示例8: create

 def create(self, fieldname, direction='thumbnail',
            height=None, width=None, **parameters):
     """ factory for image scales, see `IImageScaleStorage.scale` """
     if not IPersistentCoverTile.providedBy(self.context):
         base_scales = queryMultiAdapter((self.context, self.request),
                                         name='images', default=None)
         return base_scales and base_scales.create(fieldname,
                                                   direction,
                                                   height,
                                                   width,
                                                   **parameters)
     orig_value = self.context.data.get(fieldname)
     if orig_value is None:
         return
     if height is None and width is None:
         _, format = orig_value.contentType.split('/', 1)
         return None, format, (orig_value._width, orig_value._height)
     if safe_hasattr(aq_base(orig_value), 'open'):
         orig_data = orig_value.open()
     else:
         orig_data = getattr(aq_base(orig_value), 'data', orig_value)
     if not orig_data:
         return
     try:
         result = scaleImage(orig_data, direction=direction,
                             height=height, width=width, **parameters)
     except (ConflictError, KeyboardInterrupt):
         raise
     except Exception:  # FIXME: B901 blind except: statement
         logging.exception(
             'could not scale "{0}" of {1}'.format(
                 repr(orig_value),
                 repr(self.context.context.absolute_url())))
         return
     if result is not None:
         data, format_, dimensions = result
         mimetype = 'image/' + format_.lower()
         value = orig_value.__class__(data, contentType=mimetype,
                                      filename=orig_value.filename)
         value.fieldname = fieldname
         return value, format_, dimensions
开发者ID:collective,项目名称:collective.cover,代码行数:41,代码来源:scaling.py

示例9: _enabled

 def _enabled(self, name):
     tile = getMultiAdapter((self.context, self.request), name=name)
     return IPersistentCoverTile.providedBy(tile)
开发者ID:agnogueira,项目名称:collective.cover,代码行数:3,代码来源:vocabularies.py

示例10: test_interface

    def test_interface(self):
        self.assertTrue(IPersistentCoverTile.implementedBy(BannerTile))
        self.assertTrue(verifyClass(IPersistentCoverTile, BannerTile))

        tile = BannerTile(None, None)
        self.assertTrue(IPersistentCoverTile.providedBy(tile))
开发者ID:plonegovbr,项目名称:brasil.gov.tiles,代码行数:6,代码来源:test_banner.py

示例11: test_interface

 def test_interface(self):
     self.assertTrue(IPersistentCoverTile.implementedBy(ICarrosselTile))
开发者ID:prodamspsites,项目名称:prodam.tiles,代码行数:2,代码来源:test_carrossel_tile.py


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