Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added deprecation warning in tiles. #248

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/plonegovbr/brasil.gov.tiles/issues/240>`_).
[claytonc]


1.6.1 (2018-06-11)
Expand Down
9 changes: 9 additions & 0 deletions src/brasil/gov/tiles/tiles/banner_rotativo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from zope import schema
from zope.interface import implementer

import warnings


class IBannerRotativoTile(IListTile):
"""
Expand Down Expand Up @@ -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):
Expand Down
9 changes: 9 additions & 0 deletions src/brasil/gov/tiles/tiles/destaque.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/brasil/gov/tiles/tiles/em_destaque.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from zope import schema
from zope.interface import implementer

import warnings


class IEmDestaqueTile(IPersistentCoverTile):

Expand All @@ -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()
9 changes: 9 additions & 0 deletions src/brasil/gov/tiles/tiles/mediacarousel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope import schema

import warnings


class IMediaCarouselTile(IListTile):
"""
Expand Down Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions src/brasil/gov/tiles/tiles/social.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from zope import schema
from zope.interface import implementer

import warnings


class ISocialTile(IPersistentCoverTile):

Expand Down Expand Up @@ -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']

Expand Down