From 66339cb282e8668356f006008d054fb719117502 Mon Sep 17 00:00:00 2001 From: Roel Bruggink Date: Fri, 1 Dec 2017 21:33:33 +0100 Subject: [PATCH 01/10] Just put the content on the site root --- plone/app/contenttypes/setuphandlers.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/plone/app/contenttypes/setuphandlers.py b/plone/app/contenttypes/setuphandlers.py index e28d1bb21..773c8d2a4 100644 --- a/plone/app/contenttypes/setuphandlers.py +++ b/plone/app/contenttypes/setuphandlers.py @@ -153,9 +153,7 @@ def _setup_constrains(container, allowed_types): def create_frontpage(portal, target_language): - frontpage_id = 'front-page' - - if frontpage_id not in portal.keys(): + if True: title = _translate( u'front-title', target_language, @@ -165,12 +163,8 @@ def create_frontpage(portal, target_language): u'front-description', target_language, u'Congratulations! You have successfully installed Plone.' ) - content = createContent( - 'Document', id=frontpage_id, - title=title, - description=description, - language=target_language.replace('_', '-').lower()) - content = addContentToContainer(portal, content) + portal.title= title + portal.description = description front_text = None if target_language != 'en': util = queryUtility(ITranslationDomain, 'plonefrontpage') @@ -189,15 +183,12 @@ def create_frontpage(portal, target_language): ) if view is not None: front_text = bodyfinder(view.index()).strip() - content.text = RichTextValue( + portal.text = RichTextValue( front_text, 'text/html', 'text/x-html-safe' ) - - portal.setDefaultPage('front-page') - _publish(content) - content.reindexObject() + portal.reindexObject() def create_news_topic(portal, target_language): From 7349f54be0c50d6a6b23b6d3560a42ce97538043 Mon Sep 17 00:00:00 2001 From: Roel Bruggink Date: Tue, 31 Jul 2018 22:51:41 +0200 Subject: [PATCH 02/10] Remove old tests + update changelog --- CHANGES.rst | 5 +++++ .../tests/test_content_profile.py | 21 ------------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 3d683f9a4..898a47e69 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -19,6 +19,11 @@ Breaking changes: 'plone.app.contenttypes.behaviors.richtext.IRichTextBehavior' [iham] +- Plone Site is now a DX container. This means that the front-page object no + longer exists. + Refs PLIP 2454. + [jaroel] + New features: - By using correct (Marker-)Interfaces for the ILeadImage and IRichText, diff --git a/plone/app/contenttypes/tests/test_content_profile.py b/plone/app/contenttypes/tests/test_content_profile.py index befdee18c..d1d0c3706 100644 --- a/plone/app/contenttypes/tests/test_content_profile.py +++ b/plone/app/contenttypes/tests/test_content_profile.py @@ -45,27 +45,6 @@ def setUp(self): self.portal = self.layer['portal'] self.portal_workflow = getToolByName(self.portal, 'portal_workflow') - # #################### # - # front-page tests # - # #################### # - - def test_frontpage_was_created(self): - # Was the object created? - obj = self.portal['front-page'] - self.assertEqual(obj.portal_type, 'Document') - - def test_frontpage_is_default_page(self): - # Has the object been set on the container as the default page? - self.assertEqual(self.portal.default_page, 'front-page') - - def test_frontpage_is_published(self): - # Has the content object been published? - front_page = self.portal['front-page'] - current_state = self.portal_workflow.getInfoFor( - front_page, - 'review_state') - self.assertEqual(current_state, 'published') - # ################# # # Members tests # # ################# # From fed9890853decd5b5e2bffee855919eaa91e8b59 Mon Sep 17 00:00:00 2001 From: Roel Bruggink Date: Mon, 4 Mar 2019 16:00:40 +0100 Subject: [PATCH 03/10] strip whitespace in robot test and stick value --- plone/app/contenttypes/tests/robot/keywords.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plone/app/contenttypes/tests/robot/keywords.txt b/plone/app/contenttypes/tests/robot/keywords.txt index fa4df7d85..adca67fb7 100644 --- a/plone/app/contenttypes/tests/robot/keywords.txt +++ b/plone/app/contenttypes/tests/robot/keywords.txt @@ -127,8 +127,6 @@ I set the criteria ${type} in row ${number} to the options '${label}' I set the criteria ${type} in row ${number} to the text '${label}' ${criteria_row} = Convert to String .querystring-criteria-wrapper:nth-child(${number}) - Input text css=${criteria_row} .querystring-criteria-value input ${label}\t + Input text css=${criteria_row} .querystring-criteria-value input ${label.strip()} [Documentation] Shift the focus so the input sticks, and wait a bit - Sleep 1.5 - Focus css=.querystring-sortreverse - Sleep 1.5 + Click Element css=.querystring-preview From 942c48cf1a6e75f7e14b385d7e637d69e75bc180 Mon Sep 17 00:00:00 2001 From: Roel Bruggink Date: Sat, 12 Dec 2020 18:14:53 +0100 Subject: [PATCH 04/10] Fix robot tests. --- .../tests/robot/test_collection_location_criterion.robot | 4 ++++ .../tests/robot/test_collection_short_name_criterion.robot | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plone/app/contenttypes/tests/robot/test_collection_location_criterion.robot b/plone/app/contenttypes/tests/robot/test_collection_location_criterion.robot index 120541047..f3c527600 100644 --- a/plone/app/contenttypes/tests/robot/test_collection_location_criterion.robot +++ b/plone/app/contenttypes/tests/robot/test_collection_location_criterion.robot @@ -76,6 +76,8 @@ I set the collection's relative location criterion to I set the criteria operator in row 1 to the option 'Relative path' I set the criteria value in row 1 to the text '${criterion}' + Click Element form.widgets.IDublinCore.title + Sleep 1.5 Click Button Save Wait until page contains Changes saved @@ -91,5 +93,7 @@ I set the collection's absolute location criterion to I set the criteria operator in row 1 to the option 'Absolute path' I set the criteria value in row 1 to the text '${criterion}' + Click Element form.widgets.IDublinCore.title + Sleep 1.5 Click Button Save Wait until page contains Changes saved diff --git a/plone/app/contenttypes/tests/robot/test_collection_short_name_criterion.robot b/plone/app/contenttypes/tests/robot/test_collection_short_name_criterion.robot index 6d435b8e0..7067a574d 100644 --- a/plone/app/contenttypes/tests/robot/test_collection_short_name_criterion.robot +++ b/plone/app/contenttypes/tests/robot/test_collection_short_name_criterion.robot @@ -42,6 +42,7 @@ I set the collection short name (id) criterion to I set the criteria operator in row 1 to the option 'Is' I set the criteria value in row 1 to the text '${criterion}' - Sleep 1 + Click Element form.widgets.IDublinCore.title + Sleep 1.5 Click Button Save Wait until page contains Changes saved From c4d837db2396cf6f37a5168195bfd7fb1e2890a6 Mon Sep 17 00:00:00 2001 From: ale-rt Date: Wed, 10 Feb 2021 09:56:28 +0100 Subject: [PATCH 05/10] Try to not change an already configured site --- plone/app/contenttypes/setuphandlers.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/plone/app/contenttypes/setuphandlers.py b/plone/app/contenttypes/setuphandlers.py index 773c8d2a4..3b6f3a2f7 100644 --- a/plone/app/contenttypes/setuphandlers.py +++ b/plone/app/contenttypes/setuphandlers.py @@ -153,18 +153,21 @@ def _setup_constrains(container, allowed_types): def create_frontpage(portal, target_language): - if True: - title = _translate( + changed = False + if not portal.title: + portal.title = _translate( u'front-title', target_language, u'Welcome to Plone' ) - description = _translate( + changed = True + if not portal.description: + portal.description = _translate( u'front-description', target_language, u'Congratulations! You have successfully installed Plone.' ) - portal.title= title - portal.description = description + changed = True + if not portal.text: front_text = None if target_language != 'en': util = queryUtility(ITranslationDomain, 'plonefrontpage') @@ -188,6 +191,8 @@ def create_frontpage(portal, target_language): 'text/html', 'text/x-html-safe' ) + changed = True + if changed: portal.reindexObject() From c4cac77014ff6c247f327836daf65c362b21cd3c Mon Sep 17 00:00:00 2001 From: ale-rt Date: Wed, 10 Feb 2021 10:46:44 +0100 Subject: [PATCH 06/10] Modify the plone site when there is no text --- plone/app/contenttypes/setuphandlers.py | 73 ++++++++++++------------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/plone/app/contenttypes/setuphandlers.py b/plone/app/contenttypes/setuphandlers.py index 3b6f3a2f7..a2261918a 100644 --- a/plone/app/contenttypes/setuphandlers.py +++ b/plone/app/contenttypes/setuphandlers.py @@ -153,47 +153,42 @@ def _setup_constrains(container, allowed_types): def create_frontpage(portal, target_language): - changed = False - if not portal.title: - portal.title = _translate( - u'front-title', - target_language, - u'Welcome to Plone' - ) - changed = True - if not portal.description: - portal.description = _translate( - u'front-description', target_language, - u'Congratulations! You have successfully installed Plone.' - ) - changed = True - if not portal.text: - front_text = None - if target_language != 'en': - util = queryUtility(ITranslationDomain, 'plonefrontpage') - if util is not None: - translated_text = util.translate( - u'front-text', - target_language=target_language - ) - if translated_text != u'front-text': - front_text = translated_text - request = getattr(portal, 'REQUEST', None) - if front_text is None and request is not None: - view = queryMultiAdapter( - (portal, request), - name='plone-frontpage-setup' + if portal.text: + # Do not overwrite existing content + return + portal.title = _translate( + u'front-title', + target_language, + u'Welcome to Plone' + ) + portal.description = _translate( + u'front-description', target_language, + u'Congratulations! You have successfully installed Plone.' + ) + front_text = None + if target_language != 'en': + util = queryUtility(ITranslationDomain, 'plonefrontpage') + if util is not None: + translated_text = util.translate( + u'front-text', + target_language=target_language ) - if view is not None: - front_text = bodyfinder(view.index()).strip() - portal.text = RichTextValue( - front_text, - 'text/html', - 'text/x-html-safe' + if translated_text != u'front-text': + front_text = translated_text + request = getattr(portal, 'REQUEST', None) + if front_text is None and request is not None: + view = queryMultiAdapter( + (portal, request), + name='plone-frontpage-setup' ) - changed = True - if changed: - portal.reindexObject() + if view is not None: + front_text = bodyfinder(view.index()).strip() + portal.text = RichTextValue( + front_text, + 'text/html', + 'text/x-html-safe' + ) + portal.reindexObject() def create_news_topic(portal, target_language): From 6fcbf966fcfd0a0f730557386601ea87743d2bf7 Mon Sep 17 00:00:00 2001 From: ale-rt Date: Wed, 10 Feb 2021 11:06:58 +0100 Subject: [PATCH 07/10] Restore some tests --- .../robot/test_collection_location_criterion.robot | 4 ---- .../robot/test_collection_short_name_criterion.robot | 3 +-- plone/app/contenttypes/tests/test_content_profile.py | 12 ++++++++++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/plone/app/contenttypes/tests/robot/test_collection_location_criterion.robot b/plone/app/contenttypes/tests/robot/test_collection_location_criterion.robot index f3c527600..120541047 100644 --- a/plone/app/contenttypes/tests/robot/test_collection_location_criterion.robot +++ b/plone/app/contenttypes/tests/robot/test_collection_location_criterion.robot @@ -76,8 +76,6 @@ I set the collection's relative location criterion to I set the criteria operator in row 1 to the option 'Relative path' I set the criteria value in row 1 to the text '${criterion}' - Click Element form.widgets.IDublinCore.title - Sleep 1.5 Click Button Save Wait until page contains Changes saved @@ -93,7 +91,5 @@ I set the collection's absolute location criterion to I set the criteria operator in row 1 to the option 'Absolute path' I set the criteria value in row 1 to the text '${criterion}' - Click Element form.widgets.IDublinCore.title - Sleep 1.5 Click Button Save Wait until page contains Changes saved diff --git a/plone/app/contenttypes/tests/robot/test_collection_short_name_criterion.robot b/plone/app/contenttypes/tests/robot/test_collection_short_name_criterion.robot index 7067a574d..6d435b8e0 100644 --- a/plone/app/contenttypes/tests/robot/test_collection_short_name_criterion.robot +++ b/plone/app/contenttypes/tests/robot/test_collection_short_name_criterion.robot @@ -42,7 +42,6 @@ I set the collection short name (id) criterion to I set the criteria operator in row 1 to the option 'Is' I set the criteria value in row 1 to the text '${criterion}' - Click Element form.widgets.IDublinCore.title - Sleep 1.5 + Sleep 1 Click Button Save Wait until page contains Changes saved diff --git a/plone/app/contenttypes/tests/test_content_profile.py b/plone/app/contenttypes/tests/test_content_profile.py index 1a7722551..b2f1c471a 100644 --- a/plone/app/contenttypes/tests/test_content_profile.py +++ b/plone/app/contenttypes/tests/test_content_profile.py @@ -45,6 +45,18 @@ def setUp(self): self.portal = self.layer['portal'] self.portal_workflow = getToolByName(self.portal, 'portal_workflow') + # #################### # + # front-page tests # + # #################### # + + def test_homepage(self): + self.assertEqual(self.portal.title, "Welcome to Plone") + self.assertEqual( + self.portal.description, + "Congratulations! You have successfully installed Plone." + ) + self.assertIn("Welcome!", self.portal.text.raw) + # ################# # # Members tests # # ################# # From b3bf8f1402d9f693e57613a00a3e228c171a57ae Mon Sep 17 00:00:00 2001 From: ale-rt Date: Thu, 11 Feb 2021 16:16:00 +0100 Subject: [PATCH 08/10] Restore robot test --- plone/app/contenttypes/tests/robot/keywords.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plone/app/contenttypes/tests/robot/keywords.txt b/plone/app/contenttypes/tests/robot/keywords.txt index e6d346528..f9323934b 100644 --- a/plone/app/contenttypes/tests/robot/keywords.txt +++ b/plone/app/contenttypes/tests/robot/keywords.txt @@ -127,7 +127,7 @@ I set the criteria ${type} in row ${number} to the options '${label}' I set the criteria ${type} in row ${number} to the text '${label}' ${criteria_row} = Convert to String .querystring-criteria-wrapper:nth-child(${number}) - Input text css=${criteria_row} .querystring-criteria-value input ${label.strip()} + Input text css=${criteria_row} .querystring-criteria-value input ${label}\t [Documentation] Shift the focus so the input sticks, and wait a bit Sleep 1.5 Set Focus To Element css=.querystring-sortreverse From 6b40140617675a7545afc69594de29d65ad702ad Mon Sep 17 00:00:00 2001 From: ale-rt Date: Thu, 11 Feb 2021 16:27:31 +0100 Subject: [PATCH 09/10] Move the changelog entry to the news folder --- CHANGES.rst | 5 ----- news/475.breaking | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 news/475.breaking diff --git a/CHANGES.rst b/CHANGES.rst index ed56abcbc..029e2d645 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -288,11 +288,6 @@ Breaking changes: [iham] -- Plone Site is now a DX container. This means that the front-page object no - longer exists. - Refs PLIP 2454. - [jaroel] - New features: - By using correct (Marker-)Interfaces for the ILeadImage and IRichText, diff --git a/news/475.breaking b/news/475.breaking new file mode 100644 index 000000000..d5345a2d6 --- /dev/null +++ b/news/475.breaking @@ -0,0 +1,4 @@ +Plone Site is now a DX container. This means that the front-page object no +longer exists. +Refs PLIP 2454. +[jaroel] From 6fc1777d79ea08fb1553d1e0549e988ed1c1dfef Mon Sep 17 00:00:00 2001 From: ale-rt Date: Fri, 23 Apr 2021 15:24:53 +0200 Subject: [PATCH 10/10] url is a string, so it is not callable --- plone/app/contenttypes/browser/link_redirect_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plone/app/contenttypes/browser/link_redirect_view.py b/plone/app/contenttypes/browser/link_redirect_view.py index ad75b9a9c..fc8e7419c 100644 --- a/plone/app/contenttypes/browser/link_redirect_view.py +++ b/plone/app/contenttypes/browser/link_redirect_view.py @@ -91,7 +91,7 @@ def display_link(self): 'meta': meta, } - parsed = urlparse(url()) + parsed = urlparse(url) if parsed.scheme == 'mailto': return { 'title': parsed.path,