Skip to content

Commit

Permalink
[fc] Repository: plone.app.multilingual
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2018-03-26T10:29:26+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: plone/plone.app.multilingual@ce6d4b1

remove language-switcher after uninstall

Files changed:
M src/plone/app/multilingual/setuphandlers.py
Repository: plone.app.multilingual

Branch: refs/heads/master
Date: 2018-03-26T10:55:10+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: plone/plone.app.multilingual@6a0a5ae

add a uninstall test

Files changed:
A src/plone/app/multilingual/tests/test_uninstall.py
Repository: plone.app.multilingual

Branch: refs/heads/master
Date: 2018-03-26T10:57:34+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: plone/plone.app.multilingual@9bda243

changelog

Files changed:
M CHANGES.rst
Repository: plone.app.multilingual

Branch: refs/heads/master
Date: 2018-03-26T13:58:06+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.app.multilingual@f99b2d6

Merge pull request #309 from plone/improve-uninstall

Improve uninstall

Files changed:
A src/plone/app/multilingual/tests/test_uninstall.py
M CHANGES.rst
M src/plone/app/multilingual/setuphandlers.py
  • Loading branch information
jensens committed Mar 26, 2018
1 parent a6109c9 commit f18bc8d
Showing 1 changed file with 213 additions and 63 deletions.
276 changes: 213 additions & 63 deletions last_commit.txt
Expand Up @@ -2,117 +2,267 @@ Repository: plone.app.multilingual


Branch: refs/heads/master
Date: 2018-03-22T08:46:01+01:00
Date: 2018-03-26T10:29:26+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: https://github.com/plone/plone.app.multilingual/commit/12b163897ca6c5ef760f8a754388c335d1585afb
Commit: https://github.com/plone/plone.app.multilingual/commit/ce6d4b17a96924836a727d6b9050cc02b0175b75

use i18n:name to avoid DYNAMIC_CONTENT in po files
remove language-switcher after uninstall

Files changed:
M src/plone/app/multilingual/browser/templates/controlpanel.pt

diff --git a/src/plone/app/multilingual/browser/templates/controlpanel.pt b/src/plone/app/multilingual/browser/templates/controlpanel.pt
index 429a0aff..fca5b46e 100644
--- a/src/plone/app/multilingual/browser/templates/controlpanel.pt
+++ b/src/plone/app/multilingual/browser/templates/controlpanel.pt
@@ -29,14 +29,14 @@
<div>
<p i18n:translate="">
The
- <a tal:attributes="href string:${context/absolute_url}/multilingual-map">multilingual map view
+ <a i18n:name="url" i18n:translate="" tal:attributes="href string:${context/absolute_url}/multilingual-map">multilingual map view
</a>
allows you to view in a graphical manner the already translated items and its relations.
</p>
<p i18n:translate=""
tal:condition="view/isLPinstalled">
In case you want to migrate from Products.LinguaPlone access to the
- <a tal:attributes="href string:${context/absolute_url}/lp-migration">migration procedure.
+ <a i18n:name="url" i18n:translate="" tal:attributes="href string:${context/absolute_url}/lp-migration">migration procedure.
</a>
</p>
</div>
M src/plone/app/multilingual/setuphandlers.py

diff --git a/src/plone/app/multilingual/setuphandlers.py b/src/plone/app/multilingual/setuphandlers.py
index 8f56cf18..56406645 100644
--- a/src/plone/app/multilingual/setuphandlers.py
+++ b/src/plone/app/multilingual/setuphandlers.py
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
+from logging import getLogger
from plone.app.multilingual.browser.setup import SetupMultilingualSite
from Products.CMFPlone.interfaces import INonInstallable
+from Products.CMFPlone.utils import getToolByName
from zope.component.hooks import getSite
from zope.interface import implementer

@@ -63,6 +65,7 @@ def step_uninstall_various(context):
return
portal = context.getSite()
disable_translatable_behavior(portal)
+ disable_language_switcher(portal)


def disable_translatable_behavior(portal):
@@ -81,3 +84,16 @@ def disable_translatable_behavior(portal):
'plone.app.multilingual.dx.interfaces.IDexterityTranslatable'
]
fti._updateProperty('behaviors', behaviors)
+
+
+def disable_language_switcher(portal):
+ """Remove the use of language-switcher as default view for Plone Site"""
+ tt = getToolByName(portal, 'portal_types')
+ site = tt['Plone Site']
+ methods = site.view_methods
+ site.view_methods = [m for m in methods if m != 'language-switcher']
+ if site.default_view == 'language-switcher':
+ site.default_view = 'listing_view'
+
+ log = getLogger('setuphandlers.disable_language_switcher')
+ log.info('Language switcher disabled')


Repository: plone.app.multilingual


Branch: refs/heads/master
Date: 2018-03-22T08:46:04+01:00
Date: 2018-03-26T10:55:10+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: https://github.com/plone/plone.app.multilingual/commit/8fd1e0f8d541769f6a239b47b79b5c13b88707b1
Commit: https://github.com/plone/plone.app.multilingual/commit/6a0a5ae1622a16b33bcdcf0d5babb34cf6fd319c

add a uninstall test

Files changed:
A src/plone/app/multilingual/tests/test_uninstall.py

diff --git a/src/plone/app/multilingual/tests/test_uninstall.py b/src/plone/app/multilingual/tests/test_uninstall.py
new file mode 100644
index 00000000..5a3aed5a
--- /dev/null
+++ b/src/plone/app/multilingual/tests/test_uninstall.py
@@ -0,0 +1,44 @@
+from plone import api
+from plone.app.testing import setRoles
+from plone.app.testing import TEST_USER_ID
+from plone.app.multilingual.testing import PLONE_APP_MULTILINGUAL_INTEGRATION_TESTING # noqa
+
+import unittest
+
+class TestUninstall(unittest.TestCase):
+
+ layer = PLONE_APP_MULTILINGUAL_INTEGRATION_TESTING
+
+ def setUp(self):
+ self.portal = self.layer['portal']
+ self.installer = api.portal.get_tool('portal_quickinstaller')
+ roles_before = api.user.get_roles(TEST_USER_ID)
+ setRoles(self.portal, TEST_USER_ID, ['Manager'])
+ self.installer.uninstallProducts(['plone.app.multilingual'])
+ setRoles(self.portal, TEST_USER_ID, roles_before)
+
+ def test_product_uninstalled(self):
+ """Test if plone.app.multilingual is cleanly uninstalled."""
+ self.assertFalse(self.installer.isProductInstalled(
+ 'plone.app.multilingual'))
+
+ def test_browserlayer_removed(self):
+ """Test that IPloneAppMultilingualInstalled is removed."""
+ from plone.app.multilingual.interfaces import \
+ IPloneAppMultilingualInstalled
+ from plone.browserlayer import utils
+ self.assertNotIn(
+ IPloneAppMultilingualInstalled,
+ utils.registered_layers())
+
+ def test_language_switcher_not_in_available_view_methods(self):
+ self.assertNotIn(
+ 'language-switcher',
+ self.portal.portal_types['Plone Site'].view_methods
+ )
+
+ def test_language_switcher_not_default_view_method(self):
+ self.assertNotEqual(
+ 'language-switcher',
+ self.portal.portal_types['Plone Site'].default_view
+ )


Repository: plone.app.multilingual


Branch: refs/heads/master
Date: 2018-03-26T10:57:34+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: https://github.com/plone/plone.app.multilingual/commit/9bda24355bba95791c1bba1938d51fd2c8685b34

changelog

Files changed:
M CHANGES.rst

diff --git a/CHANGES.rst b/CHANGES.rst
index 85fafe06..336f5101 100644
index 336f5101..076ab4f5 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -15,6 +15,9 @@ New features:

Bug fixes:

+- Fix i18n markup in multilingual map to avoid ${DYNAMIC_CONTENT} strings in po files
+- Remove `language-switcher` from available view methods when uninstalling
+ [erral]
+
- Fix i18n markup of the viewlet shown in the translation creation view.
[erral]
- Fix i18n markup in multilingual map to avoid ${DYNAMIC_CONTENT} strings in po files
[erral]



Repository: plone.app.multilingual


Branch: refs/heads/master
Date: 2018-03-23T12:45:39+01:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: https://github.com/plone/plone.app.multilingual/commit/9382cf8d5289289c914b0328179c88eb57bf4121
Date: 2018-03-26T13:58:06+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/plone.app.multilingual/commit/f99b2d6e671d8b5f6cd06e7416d8adee6ab3fca5

Merge pull request #308 from plone/fix-dynamic-content
Merge pull request #309 from plone/improve-uninstall

Fix ${DYNAMIC_CONTENT} in translation files
Improve uninstall

Files changed:
A src/plone/app/multilingual/tests/test_uninstall.py
M CHANGES.rst
M src/plone/app/multilingual/browser/templates/controlpanel.pt
M src/plone/app/multilingual/setuphandlers.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 85fafe06..336f5101 100644
index 336f5101..076ab4f5 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -15,6 +15,9 @@ New features:

Bug fixes:

+- Fix i18n markup in multilingual map to avoid ${DYNAMIC_CONTENT} strings in po files
+- Remove `language-switcher` from available view methods when uninstalling
+ [erral]
+
- Fix i18n markup of the viewlet shown in the translation creation view.
[erral]
- Fix i18n markup in multilingual map to avoid ${DYNAMIC_CONTENT} strings in po files
[erral]

diff --git a/src/plone/app/multilingual/setuphandlers.py b/src/plone/app/multilingual/setuphandlers.py
index 8f56cf18..56406645 100644
--- a/src/plone/app/multilingual/setuphandlers.py
+++ b/src/plone/app/multilingual/setuphandlers.py
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
+from logging import getLogger
from plone.app.multilingual.browser.setup import SetupMultilingualSite
from Products.CMFPlone.interfaces import INonInstallable
+from Products.CMFPlone.utils import getToolByName
from zope.component.hooks import getSite
from zope.interface import implementer

@@ -63,6 +65,7 @@ def step_uninstall_various(context):
return
portal = context.getSite()
disable_translatable_behavior(portal)
+ disable_language_switcher(portal)

diff --git a/src/plone/app/multilingual/browser/templates/controlpanel.pt b/src/plone/app/multilingual/browser/templates/controlpanel.pt
index 429a0aff..fca5b46e 100644
--- a/src/plone/app/multilingual/browser/templates/controlpanel.pt
+++ b/src/plone/app/multilingual/browser/templates/controlpanel.pt
@@ -29,14 +29,14 @@
<div>
<p i18n:translate="">
The
- <a tal:attributes="href string:${context/absolute_url}/multilingual-map">multilingual map view
+ <a i18n:name="url" i18n:translate="" tal:attributes="href string:${context/absolute_url}/multilingual-map">multilingual map view
</a>
allows you to view in a graphical manner the already translated items and its relations.
</p>
<p i18n:translate=""
tal:condition="view/isLPinstalled">
In case you want to migrate from Products.LinguaPlone access to the
- <a tal:attributes="href string:${context/absolute_url}/lp-migration">migration procedure.
+ <a i18n:name="url" i18n:translate="" tal:attributes="href string:${context/absolute_url}/lp-migration">migration procedure.
</a>
</p>
</div>

def disable_translatable_behavior(portal):
@@ -81,3 +84,16 @@ def disable_translatable_behavior(portal):
'plone.app.multilingual.dx.interfaces.IDexterityTranslatable'
]
fti._updateProperty('behaviors', behaviors)
+
+
+def disable_language_switcher(portal):
+ """Remove the use of language-switcher as default view for Plone Site"""
+ tt = getToolByName(portal, 'portal_types')
+ site = tt['Plone Site']
+ methods = site.view_methods
+ site.view_methods = [m for m in methods if m != 'language-switcher']
+ if site.default_view == 'language-switcher':
+ site.default_view = 'listing_view'
+
+ log = getLogger('setuphandlers.disable_language_switcher')
+ log.info('Language switcher disabled')
diff --git a/src/plone/app/multilingual/tests/test_uninstall.py b/src/plone/app/multilingual/tests/test_uninstall.py
new file mode 100644
index 00000000..5a3aed5a
--- /dev/null
+++ b/src/plone/app/multilingual/tests/test_uninstall.py
@@ -0,0 +1,44 @@
+from plone import api
+from plone.app.testing import setRoles
+from plone.app.testing import TEST_USER_ID
+from plone.app.multilingual.testing import PLONE_APP_MULTILINGUAL_INTEGRATION_TESTING # noqa
+
+import unittest
+
+class TestUninstall(unittest.TestCase):
+
+ layer = PLONE_APP_MULTILINGUAL_INTEGRATION_TESTING
+
+ def setUp(self):
+ self.portal = self.layer['portal']
+ self.installer = api.portal.get_tool('portal_quickinstaller')
+ roles_before = api.user.get_roles(TEST_USER_ID)
+ setRoles(self.portal, TEST_USER_ID, ['Manager'])
+ self.installer.uninstallProducts(['plone.app.multilingual'])
+ setRoles(self.portal, TEST_USER_ID, roles_before)
+
+ def test_product_uninstalled(self):
+ """Test if plone.app.multilingual is cleanly uninstalled."""
+ self.assertFalse(self.installer.isProductInstalled(
+ 'plone.app.multilingual'))
+
+ def test_browserlayer_removed(self):
+ """Test that IPloneAppMultilingualInstalled is removed."""
+ from plone.app.multilingual.interfaces import \
+ IPloneAppMultilingualInstalled
+ from plone.browserlayer import utils
+ self.assertNotIn(
+ IPloneAppMultilingualInstalled,
+ utils.registered_layers())
+
+ def test_language_switcher_not_in_available_view_methods(self):
+ self.assertNotIn(
+ 'language-switcher',
+ self.portal.portal_types['Plone Site'].view_methods
+ )
+
+ def test_language_switcher_not_default_view_method(self):
+ self.assertNotEqual(
+ 'language-switcher',
+ self.portal.portal_types['Plone Site'].default_view
+ )


0 comments on commit f18bc8d

Please sign in to comment.