diff --git a/CHANGES.rst b/CHANGES.rst index 9dcf62c..36d88a8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -28,6 +28,10 @@ Changelog [hvelarde] - Corrige tratamento de fuso horário na view padrão do tipo de conteúdo ``AgendaDiaria``; +- Remove o campo ``subjects`` dos tipos de conteúdo ``Agenda``, ``AgendaDiaria`` e ``Compromisso`` por ser considerado `desnecessário `_. + [hvelarde] + +- Corrije tratamento de fuso horário na view padrão do tipo de conteúdo ``AgendaDiaria``; isso evita mudanças na hora dos compromissos em browsers com um fuso horário diferente do vigente no Brasil. [rodfersou, hvelarde] diff --git a/src/brasil/gov/agenda/content/agenda.py b/src/brasil/gov/agenda/content/agenda.py index e075689..8d51837 100644 --- a/src/brasil/gov/agenda/content/agenda.py +++ b/src/brasil/gov/agenda/content/agenda.py @@ -1,19 +1,9 @@ # -*- coding: utf-8 -*- from brasil.gov.agenda.interfaces import IAgenda from plone.dexterity.content import Container -from plone.dexterity.utils import safe_utf8 -from plone.indexer.decorator import indexer from zope.interface import implementer @implementer(IAgenda) class Agenda(Container): """Agenda de um membro do Governo Brasileiro""" - - -@indexer(IAgenda) -def tags(obj): - """Indexa tags de Agenda.""" - if obj.subjects is None: - return () - return tuple(safe_utf8(s) for s in obj.subjects) diff --git a/src/brasil/gov/agenda/content/agendadiaria.py b/src/brasil/gov/agenda/content/agendadiaria.py index ff49713..367932c 100644 --- a/src/brasil/gov/agenda/content/agendadiaria.py +++ b/src/brasil/gov/agenda/content/agendadiaria.py @@ -8,7 +8,6 @@ from DateTime import DateTime from plone import api from plone.dexterity.content import Container -from plone.dexterity.utils import safe_utf8 from plone.indexer.decorator import indexer from plone.supermodel.interfaces import IDefaultFactory from Products.CMFPlone.utils import safe_hasattr @@ -93,14 +92,6 @@ def default_location(context): return getattr(context, 'location', u'') -@provider(IContextAwareDefaultFactory) -def default_subjects(context): - # XXX: deal with testing issues https://stackoverflow.com/q/35799092/644075 - if not safe_hasattr(context, 'aq_parent'): - return () - return getattr(context, 'subjects', ()) - - @provider(IDefaultFactory) def default_date(): """ Retorna um dia no futuro """ @@ -117,14 +108,6 @@ def validate(self, value): raise Invalid(_(u'Ja existe uma agenda para esta data')) -@indexer(IAgendaDiaria) -def tags(obj): - """Indexa tags de AgendaDiaria.""" - if obj.subjects is None: - return () - return tuple(safe_utf8(s) for s in obj.subjects) - - @indexer(IAgendaDiaria) def SearchableText_AgendaDiaria(obj): """ Indexa os dados dos compromissos dentro desta AgendaDiaria diff --git a/src/brasil/gov/agenda/content/compromisso.py b/src/brasil/gov/agenda/content/compromisso.py index faf5645..461c610 100644 --- a/src/brasil/gov/agenda/content/compromisso.py +++ b/src/brasil/gov/agenda/content/compromisso.py @@ -3,7 +3,6 @@ from brasil.gov.agenda.interfaces import ICompromisso from DateTime import DateTime from plone.dexterity.content import Container -from plone.dexterity.utils import safe_utf8 from plone.indexer.decorator import indexer from Products.CMFPlone.utils import safe_hasattr from zope.interface import implementer @@ -39,14 +38,6 @@ def default_location(context): return getattr(context, 'location', u'') -@provider(IContextAwareDefaultFactory) -def default_subjects(context): - # XXX: deal with testing issues https://stackoverflow.com/q/35799092/644075 - if not safe_hasattr(context, 'aq_parent'): - return () - return getattr(context, 'subjects', ()) - - @provider(IContextAwareDefaultFactory) def default_start_date(context): if IAgendaDiaria.providedBy(context): @@ -85,14 +76,6 @@ def end_date(obj): return DateTime(ICompromisso(obj).end_date) -@indexer(ICompromisso) -def tags(obj): - """Indexa tags de Compromisso.""" - if obj.subjects is None: - return () - return tuple(safe_utf8(s) for s in obj.subjects) - - @indexer(ICompromisso) def exclude_from_nav(obj): # Compromissos sempre serao ocultos da navegacao diff --git a/src/brasil/gov/agenda/content/configure.zcml b/src/brasil/gov/agenda/content/configure.zcml index 10dada0..e83a121 100644 --- a/src/brasil/gov/agenda/content/configure.zcml +++ b/src/brasil/gov/agenda/content/configure.zcml @@ -1,20 +1,13 @@ - - - + - - - diff --git a/src/brasil/gov/agenda/content/schema/Agenda.xml b/src/brasil/gov/agenda/content/schema/Agenda.xml index 45a52f6..ea8d8a0 100644 --- a/src/brasil/gov/agenda/content/schema/Agenda.xml +++ b/src/brasil/gov/agenda/content/schema/Agenda.xml @@ -23,15 +23,5 @@ False Event Location - - Tags são utilizadas para organização de conteúdo - () - () - False - Tags - - Tag - - diff --git a/src/brasil/gov/agenda/content/schema/AgendaDiaria.xml b/src/brasil/gov/agenda/content/schema/AgendaDiaria.xml index bd5108b..200f3f1 100644 --- a/src/brasil/gov/agenda/content/schema/AgendaDiaria.xml +++ b/src/brasil/gov/agenda/content/schema/AgendaDiaria.xml @@ -27,16 +27,5 @@ False Atualizacao - - Tags são utilizadas para organização de conteúdo - brasil.gov.agenda.content.agendadiaria.default_subjects - () - () - False - Tags - - Tag - - diff --git a/src/brasil/gov/agenda/content/schema/Compromisso.xml b/src/brasil/gov/agenda/content/schema/Compromisso.xml index d88ed24..9a1b24f 100644 --- a/src/brasil/gov/agenda/content/schema/Compromisso.xml +++ b/src/brasil/gov/agenda/content/schema/Compromisso.xml @@ -40,16 +40,5 @@ brasil.gov.agenda.content.compromisso.default_location Event Location - - Tags são utilizadas para organização de conteúdo - () - () - False - brasil.gov.agenda.content.compromisso.default_subjects - Tags - - Tag - - diff --git a/src/brasil/gov/agenda/tests/test_agenda.py b/src/brasil/gov/agenda/tests/test_agenda.py index 4188eb3..dbd6563 100644 --- a/src/brasil/gov/agenda/tests/test_agenda.py +++ b/src/brasil/gov/agenda/tests/test_agenda.py @@ -61,16 +61,6 @@ def test_exclude_from_nav_default(self): behavior = IExcludeFromNavigation(self.agenda) self.assertFalse(behavior.exclude_from_nav) - def test_subjects_catalog(self): - agenda = self.agenda - agenda.subjects = (u'Brasil', u'México') - agenda.reindexObject(idxs=['Subject']) - ct = self.portal.portal_catalog - results = ct.searchResults(portal_type='Agenda') - b = results[0] - self.assertIn('Brasil', b.Subject) - self.assertIn('México', b.Subject) - def test_agendadiaria_ordering(self): # Create two AgendaDiaria objects self.agenda.invokeFactory('AgendaDiaria', '2013-10-17') diff --git a/src/brasil/gov/agenda/tests/test_agendadiaria.py b/src/brasil/gov/agenda/tests/test_agendadiaria.py index 78f128a..9dbe474 100644 --- a/src/brasil/gov/agenda/tests/test_agendadiaria.py +++ b/src/brasil/gov/agenda/tests/test_agendadiaria.py @@ -75,24 +75,6 @@ def test_exclude_from_nav(self): def test_exclude_from_nav_behavior(self): self.assertFalse(IExcludeFromNavigation.providedBy(self.agendadiaria)) - def test_subjects_catalog(self): - agendadiaria = self.agendadiaria - agendadiaria.subjects = (u'Brasil', u'México') - agendadiaria.reindexObject(idxs=['Subject']) - ct = self.portal.portal_catalog - results = ct.searchResults(portal_type='AgendaDiaria') - b = results[0] - self.assertIn('Brasil', b.Subject) - self.assertIn('México', b.Subject) - - def test_default_subjects(self): - from brasil.gov.agenda.content.agendadiaria import default_subjects - agenda = self.agenda - agenda.subjects = (u'Brasil', u'México') - # default_factory é executado no container - self.assertIn(u'Brasil', default_subjects(agenda)) - self.assertIn(u'México', default_subjects(agenda)) - def test_datevalidator(self): from brasil.gov.agenda.content.agendadiaria import DateValidator from zope.interface.exceptions import Invalid diff --git a/src/brasil/gov/agenda/tests/test_compromisso.py b/src/brasil/gov/agenda/tests/test_compromisso.py index c5eb72f..53e59b9 100644 --- a/src/brasil/gov/agenda/tests/test_compromisso.py +++ b/src/brasil/gov/agenda/tests/test_compromisso.py @@ -75,24 +75,6 @@ def test_exclude_from_nav(self): def test_exclude_from_nav_behavior(self): self.assertFalse(IExcludeFromNavigation.providedBy(self.compromisso)) - def test_subjects_catalog(self): - compromisso = self.compromisso - compromisso.subjects = (u'Brasil', u'México') - compromisso.reindexObject(idxs=['Subject']) - ct = self.portal.portal_catalog - results = ct.searchResults(portal_type='Compromisso') - b = results[0] - self.assertIn('Brasil', b.Subject) - self.assertIn('México', b.Subject) - - def test_default_subjects(self): - from brasil.gov.agenda.content.compromisso import default_subjects - agendadiaria = self.agendadiaria - agendadiaria.subjects = (u'Brasil', u'México') - # default_factory é executado no container - self.assertIn(u'Brasil', default_subjects(agendadiaria)) - self.assertIn(u'México', default_subjects(agendadiaria)) - def test_default_start_date(self): from brasil.gov.agenda.content.compromisso import default_start_date date_fmt = '%Y-%m-%d %H:%M'