diff --git a/CHANGES.rst b/CHANGES.rst index 37810b39..db26971e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 1.6.2 (unreleased) ^^^^^^^^^^^^^^^^^^ -- Nothing changed yet. +- Os tiles Banner rotativo, Carrossel de mídia, Destaque, Em detaque e Social foram marcados que serão descontinuados na versão 2.x. (closes `#240 `_). + [claytonc] 1.6.1 (2018-06-11) diff --git a/src/brasil/gov/tiles/tiles/banner_rotativo.py b/src/brasil/gov/tiles/tiles/banner_rotativo.py index 8f65ebd8..5597bb8f 100644 --- a/src/brasil/gov/tiles/tiles/banner_rotativo.py +++ b/src/brasil/gov/tiles/tiles/banner_rotativo.py @@ -12,6 +12,8 @@ from zope import schema from zope.interface import implementer +import warnings + class IBannerRotativoTile(IListTile): """ @@ -84,6 +86,13 @@ class BannerRotativoTile(ListTile): is_editable = True limit = 4 + def __call__(self): + path = '/'.join(self.context.getPhysicalPath()) + msg = ('Use of tile "Banner Rotativo" is deprecated ' + 'and will be removed for the next version {0}'.format(path)) + warnings.warn(msg, DeprecationWarning) + return self.index() + def populate_with_object(self, obj): super(BannerRotativoTile, self).populate_with_object(obj) # check permission if not self._has_image_field(obj): diff --git a/src/brasil/gov/tiles/tiles/destaque.py b/src/brasil/gov/tiles/tiles/destaque.py index c952e574..032f19af 100644 --- a/src/brasil/gov/tiles/tiles/destaque.py +++ b/src/brasil/gov/tiles/tiles/destaque.py @@ -13,6 +13,8 @@ from zope.component import getUtility from zope.interface import implementer +import warnings + # XXX: we must refactor this tile class IDestaqueTile(IListTile): @@ -57,6 +59,13 @@ class DestaqueTile(ListTile): limit = 2 short_name = _(u'A highlight tile', default=u'A highlight tile') + def __call__(self): + path = '/'.join(self.context.getPhysicalPath()) + msg = ('Use of tile "Destaque" is deprecated ' + 'and will be removed for the next version {0}'.format(path)) + warnings.warn(msg, DeprecationWarning) + return self.index() + # FIXME: Até a versão 1.4b1 de collective.cover, o funcionamento da lista # do collective.cover e do brasil.gov.tiles, apesar de uma diferença ou outra # bem pontual, eram bem similares. A partir da 1.5b1, devido ao PR diff --git a/src/brasil/gov/tiles/tiles/em_destaque.py b/src/brasil/gov/tiles/tiles/em_destaque.py index b151ceee..e9827797 100644 --- a/src/brasil/gov/tiles/tiles/em_destaque.py +++ b/src/brasil/gov/tiles/tiles/em_destaque.py @@ -6,6 +6,8 @@ from zope import schema from zope.interface import implementer +import warnings + class IEmDestaqueTile(IPersistentCoverTile): @@ -31,3 +33,10 @@ class EmDestaqueTile(ListTile): is_droppable = True is_editable = False limit = 5 + + def __call__(self): + path = '/'.join(self.context.getPhysicalPath()) + msg = ('Use of tile "Em destaque" is deprecated ' + 'and will be removed for the next version {0}'.format(path)) + warnings.warn(msg, DeprecationWarning) + return self.index() diff --git a/src/brasil/gov/tiles/tiles/mediacarousel.py b/src/brasil/gov/tiles/tiles/mediacarousel.py index ff503da8..61ed5325 100644 --- a/src/brasil/gov/tiles/tiles/mediacarousel.py +++ b/src/brasil/gov/tiles/tiles/mediacarousel.py @@ -12,6 +12,8 @@ from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile from zope import schema +import warnings + class IMediaCarouselTile(IListTile): """ @@ -57,6 +59,13 @@ class MediaCarouselTile(ListTile): is_configurable = True is_editable = True + def __call__(self): + path = '/'.join(self.context.getPhysicalPath()) + msg = ('Use of tile "Media Carousel" is deprecated ' + 'and will be removed for the next version {0}'.format(path)) + warnings.warn(msg, DeprecationWarning) + return self.index() + def populate_with_object(self, obj): super(ListTile, self).populate_with_object(obj) # check permission diff --git a/src/brasil/gov/tiles/tiles/social.py b/src/brasil/gov/tiles/tiles/social.py index 2581ad74..2dc2c97a 100644 --- a/src/brasil/gov/tiles/tiles/social.py +++ b/src/brasil/gov/tiles/tiles/social.py @@ -7,6 +7,8 @@ from zope import schema from zope.interface import implementer +import warnings + class ISocialTile(IPersistentCoverTile): @@ -44,6 +46,13 @@ class SocialTile(PersistentCoverTile): is_droppable = False is_editable = True + def __call__(self): + path = '/'.join(self.context.getPhysicalPath()) + msg = ('Use of tile "Social" is deprecated ' + 'and will be removed for the next version {0}'.format(path)) + warnings.warn(msg, DeprecationWarning) + return self.index() + def get_wid(self): return self.data['wid']