Skip to content

Commit

Permalink
Update profile version to 10900
Browse files Browse the repository at this point in the history
Merge previous upgrade steps of this branch into it.
  • Loading branch information
hvelarde committed Jun 26, 2018
1 parent 4a3b539 commit 74f67cc
Show file tree
Hide file tree
Showing 17 changed files with 116 additions and 168 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Changelog
2.0a5 (unreleased)
^^^^^^^^^^^^^^^^^^

.. Warning::
Atualizações da branch 1.x do pacote só serão suportadas da versão mais recente dessa branch.

- Atualiza versão do profile usado para 10900 (closes `#472 <https://github.com/plonegovbr/brasil.gov.portal/issues/472>`_).
[hvelarde]

- Atualizado Plone à versão 4.3.17.
[hvelarde]

Expand Down
9 changes: 9 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ buildout:

5. Adicione um novo site Plone.

Atualização de 1.x a 2.x
------------------------

.. Warning::
Só atualize para a versão 2.x do pacote depois de atualizar à versão mais recente da branch 1.x.

As atualizações da versão 1.x à 2.x só são suportadas das versões mais recentes de cada branch.
Antes de atualizar confira que você está efetivamente utilizando a última versão da branch 1.x e que não existem upgrade steps pendentes de serem aplicados.

Rodando o buildout de uma tag antiga do pacote
----------------------------------------------

Expand Down
6 changes: 2 additions & 4 deletions src/brasil/gov/portal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,12 @@

HIDDEN_PROFILES = [
'archetypes.querywidget:default',
'brasil.gov.agenda.upgrades.v2000:default',
'brasil.gov.agenda.upgrades.v3000:default',
'brasil.gov.agenda.upgrades.v4000:default',
'brasil.gov.agenda.upgrades.v4100:default',
'brasil.gov.agenda:default',
'brasil.gov.barra.upgrades.v1002:default',
'brasil.gov.barra.upgrades.v1010:default',
'brasil.gov.barra:default',
'brasil.gov.portal.upgrades.v10806:default',
'brasil.gov.portal.upgrades.v10900:default',
'brasil.gov.portal:default',
'brasil.gov.portal:initcontent',
'brasil.gov.portal:uninstall',
Expand Down
4 changes: 2 additions & 2 deletions src/brasil/gov/portal/profiles/default/rolemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<role name="Site Administrator" />
</permission>
<permission name="brasil.gov.portal: Add Infographic" acquire="True">
<role name="Contributor"/>
<role name="Manager" />
<role name="Site Administrator" />
<role name="Owner"/>
<role name="Contributor"/>
<role name="Site Administrator" />
</permission>
</permissions>
</rolemap>
36 changes: 4 additions & 32 deletions src/brasil/gov/portal/tests/test_upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ def _do_upgrade(self, step):

class To10804TestCase(UpgradeBaseTestCase):

from_ = '10803'
to_ = '10804'
from_ = '*'
to_ = '10900'

def test_profile_version(self):
version = self.setup.getLastVersionForProfile(self.profile_id)[0]
self.assertEqual(version, self.from_)

def test_registered_steps(self):
steps = len(self.setup.listUpgrades(self.profile_id)[0])
self.assertEqual(steps, 3)
self.assertEqual(steps, 7)

def test_remove_styles(self):
# address also an issue with Setup permission
Expand All @@ -52,7 +52,7 @@ def test_remove_styles(self):
self.assertIsNotNone(step)

# simulate state on previous version
from brasil.gov.portal.upgrades.v10804 import STYLES
from brasil.gov.portal.upgrades.v10900 import STYLES
css_tool = api.portal.get_tool('portal_css')
for css in STYLES:
css_tool.registerResource(id=css)
Expand Down Expand Up @@ -113,20 +113,6 @@ def test_remove_nitf_customizations(self):
self.assertEqual(self.n1.getLayout(), 'view')
self.assertEqual(self.n2.getLayout(), 'view')


class To10805TestCase(UpgradeBaseTestCase):

from_ = '10804'
to_ = '10805'

def test_profile_version(self):
version = self.setup.getLastVersionForProfile(self.profile_id)[0]
self.assertEqual(version, self.from_)

def test_registered_steps(self):
steps = len(self.setup.listUpgrades(self.profile_id)[0])
self.assertEqual(steps, 1)

def test_search_for_embedder(self):
title = u'Remove sc.embedder from types_not_searched'
step = self._get_upgrade_step_by_title(title)
Expand All @@ -141,20 +127,6 @@ def test_search_for_embedder(self):
self._do_upgrade(step)
self.assertNotIn('sc.embedder', settings.types_not_searched)


class To10806TestCase(UpgradeBaseTestCase):

from_ = '10805'
to_ = '10806'

def test_profile_version(self):
version = self.setup.getLastVersionForProfile(self.profile_id)[0]
self.assertEqual(version, self.from_)

def test_registered_steps(self):
steps = len(self.setup.listUpgrades(self.profile_id)[0])
self.assertEqual(steps, 4)

# XXX: there is no clear way to remove a permission
# and then test if it has been added

Expand Down
4 changes: 1 addition & 3 deletions src/brasil/gov/portal/upgrades/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<configure xmlns="http://namespaces.zope.org/zope">
<include package=".v10804" />
<include package=".v10805" />
<include package=".v10806" />
<include package=".v10900" />
</configure>
30 changes: 0 additions & 30 deletions src/brasil/gov/portal/upgrades/v10804/configure.zcml

This file was deleted.

13 changes: 0 additions & 13 deletions src/brasil/gov/portal/upgrades/v10805/__init__.py

This file was deleted.

17 changes: 0 additions & 17 deletions src/brasil/gov/portal/upgrades/v10805/configure.zcml

This file was deleted.

23 changes: 0 additions & 23 deletions src/brasil/gov/portal/upgrades/v10806/__init__.py

This file was deleted.

43 changes: 0 additions & 43 deletions src/brasil/gov/portal/upgrades/v10806/configure.zcml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def remove_styles(setup_tool):
for css in STYLES:
css_tool.unregisterResource(id=css)
assert css not in css_tool.getResourceIds()
logger.info('Styles removed')
logger.info('Styles removed')


def show_global_sections(setup_tool):
Expand Down Expand Up @@ -60,3 +60,33 @@ def remove_nitf_customizations(setup_tool):

transaction.commit()
logger.info('Done')


def search_for_embedder(setup_tool):
"""Remove sc.embedder from types_not_searched."""
settings = api.portal.get_tool('portal_properties').site_properties
if 'sc.embedder' in settings.types_not_searched:
types_not_searched = list(settings.types_not_searched)
types_not_searched.remove('sc.embedder')
settings.types_not_searched = tuple(types_not_searched)
logger.info('Search for sc.embedder objects is enabled')


def update_galeria_image_sizes(setup_tool):
"""Update galeria de fotos image sizes."""
settings = api.portal.get_tool('portal_properties').imaging_properties
allowed_sizes = set(settings.allowed_sizes)
allowed_sizes -= frozenset([
u'galeria_de_foto_thumb 87:49', u'galeria_de_foto_view 748:513'])
allowed_sizes |= frozenset([u'galeria_de_foto_view 1150:650'])
settings.allowed_sizes = tuple(allowed_sizes)
logger.info('Galeria de fotos image sizes updated.')


def install_keyword_manager(setup_tool):
"""Install Products.PloneKeywordManager."""
addon = 'PloneKeywordManager'
qi = api.portal.get_tool('portal_quickinstaller')
if not qi.isProductInstalled(addon):
qi.installProduct(addon)
logger.info(addon + ' was installed')
61 changes: 61 additions & 0 deletions src/brasil/gov/portal/upgrades/v10900/configure.zcml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup">

<genericsetup:registerProfile
name="default"
title="brasil.gov.portal (v10900)"
directory="profile"
description='Configuration for version 10900'
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<genericsetup:upgradeSteps
source="*"
destination="10900"
profile="brasil.gov.portal:default">

<genericsetup:upgradeStep
title="Move styles to brasil.gov.temas package"
description="Move styles to brasil.gov.temas package."
handler=".remove_styles"
/>

<genericsetup:upgradeStep
title="Show back global_sections viewlet"
description="Show back global_sections viewlet."
handler=".show_global_sections"
/>

<genericsetup:upgradeStep
title="Remove collective.nitf customizations"
description="Remove customized view from types tool and set default view on objects using custom view."
handler=".remove_nitf_customizations"
/>

<genericsetup:upgradeStep
title="Remove sc.embedder from types_not_searched"
handler=".search_for_embedder"
/>

<genericsetup:upgradeDepends
title="Import various"
description="Adds new configlet and content type."
import_profile="brasil.gov.portal.upgrades.v10900:default"
/>

<genericsetup:upgradeStep
title="Update galeria image sizes."
description="Update galeria de fotos image sizes."
handler=".update_galeria_image_sizes"
/>

<genericsetup:upgradeStep
title="Install Products.PloneKeywordManager"
description=""
handler=".install_keyword_manager"
/>

</genericsetup:upgradeSteps>

</configure>

0 comments on commit 74f67cc

Please sign in to comment.