Skip to content

Commit

Permalink
[fc] Repository: plone.app.layout
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2018-09-04T16:32:11+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: plone/plone.app.layout@1164829

Failing tests showing that the byline is hidden for logged-in users

Files changed:
M plone/app/layout/viewlets/tests/test_content.py
Repository: plone.app.layout

Branch: refs/heads/master
Date: 2018-09-04T16:32:11+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: plone/plone.app.layout@b3bb2bf

show byline for logged in users

test

Files changed:
M plone/app/layout/viewlets/content.py
M plone/app/layout/viewlets/tests/test_content.py
Repository: plone.app.layout

Branch: refs/heads/master
Date: 2018-09-04T16:33:20+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: plone/plone.app.layout@60f3180

changelog

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

Branch: refs/heads/master
Date: 2018-09-06T10:00:00+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.app.layout@18b0c8e

Merge pull request #161 from plone/erral-issue-160-document-byline

Fix document byline for logged-in users

Files changed:
M CHANGES.rst
M plone/app/layout/viewlets/content.py
M plone/app/layout/viewlets/tests/test_content.py
  • Loading branch information
jensens committed Sep 6, 2018
1 parent 6bd27f5 commit 419d016
Showing 1 changed file with 31 additions and 74 deletions.
105 changes: 31 additions & 74 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,110 +1,67 @@
Repository: plone.app.querystring
Repository: plone.app.layout


Branch: refs/heads/master
Date: 2018-07-19T22:42:25+02:00
Author: Filippo Campi (eikichi18) <filippo.campi@redturtle.it>
Commit: https://github.com/plone/plone.app.querystring/commit/1941d51e17c74bbf8c18aa7366fa3c46e2f8b912
Date: 2018-09-04T16:32:11+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: https://github.com/plone/plone.app.layout/commit/1164829bf8b7c15c1b6dff6b7d0e98c46f38bea1

Removed check if query url start with root's url
Failing tests showing that the byline is hidden for logged-in users

Files changed:
M plone/app/querystring/queryparser.py
M plone/app/layout/viewlets/tests/test_content.py

b"diff --git a/plone/app/querystring/queryparser.py b/plone/app/querystring/queryparser.py\nindex b0ae6db..628baf4 100644\n--- a/plone/app/querystring/queryparser.py\n+++ b/plone/app/querystring/queryparser.py\n@@ -290,8 +290,8 @@ def _pathByRoot(root, context, row):\n # It must be a UID\n values = getPathByUID(context, values)\n # take care of absolute paths without root\n- if not values.startswith(root):\n- values = root + values\n+ # if not values.startswith(root):\n+ values = root + values\n query = {}\n if depth is not None:\n query['depth'] = depth\n"
b'diff --git a/plone/app/layout/viewlets/tests/test_content.py b/plone/app/layout/viewlets/tests/test_content.py\nindex 6fe448a..446802b 100644\n--- a/plone/app/layout/viewlets/tests/test_content.py\n+++ b/plone/app/layout/viewlets/tests/test_content.py\n@@ -78,6 +78,33 @@ def test_pub_date(self):\n self.assertEqual(viewlet.pub_date(), None)\n \n \n+ def test_anonymous_users_see_byline_if_show_enabled(self):\n+ self.security_settings.allow_anon_views_about = True\n+ self.logout()\n+ viewlet = self._get_viewlet()\n+ self.assertTrue(viewlet.show())\n+\n+ def test_anonymous_users_dont_see_byline_if_show_disabled(self):\n+ self.security_settings.allow_anon_views_about = False\n+ self.logout()\n+ viewlet = self._get_viewlet()\n+ self.assertFalse(viewlet.show())\n+\n+ def test_logged_users_see_byline_if_show_enabled(self):\n+ self.security_settings.allow_anon_views_about = True\n+ #self.logout()\n+ viewlet = self._get_viewlet()\n+ self.assertTrue(viewlet.show())\n+\n+ def test_logged_users_see_byline_if_show_disabled(self):\n+ self.security_settings.allow_anon_views_about = False\n+ #self.logout()\n+ viewlet = self._get_viewlet()\n+ self.assertTrue(viewlet.show())\n+\n+\n+\n+\n class TestHistoryBylineViewletView(ViewletsTestCase):\n """\n Test the document by line viewlet\n'

Repository: plone.app.querystring
Repository: plone.app.layout


Branch: refs/heads/master
Date: 2018-07-20T12:13:40+02:00
Author: Filippo Campi (eikichi18) <filippo.campi@redturtle.it>
Commit: https://github.com/plone/plone.app.querystring/commit/960b24ab6a82e68f250dbcb1d5fa344e33975949
Date: 2018-09-04T16:32:11+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: https://github.com/plone/plone.app.layout/commit/b3bb2bfc9d2c8d06b3803e19f87e87b63e5a4ed3

Fixed the check for when to add root to values + run test
show byline for logged in users

Files changed:
M plone/app/querystring/queryparser.py

b"diff --git a/plone/app/querystring/queryparser.py b/plone/app/querystring/queryparser.py\nindex 628baf4..c6fcd29 100644\n--- a/plone/app/querystring/queryparser.py\n+++ b/plone/app/querystring/queryparser.py\n@@ -278,6 +278,7 @@ def _afterRelativeDate(context, row):\n \n \n def _pathByRoot(root, context, row):\n+ operator = row.operator\n values = row.values\n depth = None\n if '::' in values:\n@@ -290,14 +291,16 @@ def _pathByRoot(root, context, row):\n # It must be a UID\n values = getPathByUID(context, values)\n # take care of absolute paths without root\n- # if not values.startswith(root):\n- values = root + values\n+ if not values.startswith(root + '/'):\n+ values = root + values\n query = {}\n if depth is not None:\n query['depth'] = depth\n # when a depth value is specified, a trailing slash matters on the\n # query\n values = values.rstrip('/')\n+ if operator == '_relativePath':\n+ values = values.rstrip('/')\n query['query'] = [values]\n return {row.index: query}\n \n@@ -336,7 +339,7 @@ def _relativePath(context, row):\n \n row = Row(index=row.index,\n operator=row.operator,\n- values='/'.join(obj.getPhysicalPath()) + depthstr)\n+ values='/'.join(obj.getPhysicalPath()) + '/' + depthstr)\n \n return _absolutePath(context, row)\n \n"

Repository: plone.app.querystring


Branch: refs/heads/master
Date: 2018-07-20T14:32:50+02:00
Author: Filippo Campi (eikichi18) <filippo.campi@redturtle.it>
Commit: https://github.com/plone/plone.app.querystring/commit/e75534815d4ba63ee6245bcb32125d56cbb189b7

added test for new case + updated CHANGES
test

Files changed:
M CHANGES.rst
M plone/app/querystring/tests/testQueryParser.py
M plone/app/layout/viewlets/content.py
M plone/app/layout/viewlets/tests/test_content.py

b"diff --git a/CHANGES.rst b/CHANGES.rst\nindex 0d60650..05b897b 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -4,17 +4,10 @@ Changelog\n 1.4.9 (unreleased)\n ------------------\n \n-Breaking changes:\n-\n-- *add item here*\n-\n-New features:\n-\n-- *add item here*\n-\n Bug fixes:\n \n-- *add item here*\n+- Fix a case, where objects id starts with roots id\n+ [eikichi18]\n \n \n 1.4.8 (2018-02-05)\ndiff --git a/plone/app/querystring/tests/testQueryParser.py b/plone/app/querystring/tests/testQueryParser.py\nindex 45a5700..aa97525 100644\n--- a/plone/app/querystring/tests/testQueryParser.py\n+++ b/plone/app/querystring/tests/testQueryParser.py\n@@ -610,3 +610,14 @@ def test__relativePath(self):\n def test_getPathByUID(self):\n actual = queryparser.getPathByUID(MockSite(), '00000000000000001')\n self.assertEqual(actual, '/site/foo')\n+ \n+ def test_objStartWithSiteId(self):\n+ data = Row(\n+ index='path',\n+ operator='_path',\n+ values='/{0}-news/'.format(MOCK_SITE_ID)\n+ )\n+ parsed = queryparser._absolutePath(MockSite(), data)\n+ expected = {'path': {'query': ['/{0}/{1}-news/'.format(MOCK_SITE_ID, MOCK_SITE_ID)]}}\n+ self.assertEqual(parsed, expected)\n+ \n"
b"diff --git a/plone/app/layout/viewlets/content.py b/plone/app/layout/viewlets/content.py\nindex 07e262d..9651ab2 100644\n--- a/plone/app/layout/viewlets/content.py\n+++ b/plone/app/layout/viewlets/content.py\n@@ -72,7 +72,7 @@ def show(self):\n ISecuritySchema,\n prefix='plone',\n )\n- return self.anonymous and settings.allow_anon_views_about\n+ return not self.anonymous or settings.allow_anon_views_about\n \n def creator(self):\n return self.context.Creator()\ndiff --git a/plone/app/layout/viewlets/tests/test_content.py b/plone/app/layout/viewlets/tests/test_content.py\nindex 446802b..b8914c4 100644\n--- a/plone/app/layout/viewlets/tests/test_content.py\n+++ b/plone/app/layout/viewlets/tests/test_content.py\n@@ -92,13 +92,11 @@ def test_anonymous_users_dont_see_byline_if_show_disabled(self):\n \n def test_logged_users_see_byline_if_show_enabled(self):\n self.security_settings.allow_anon_views_about = True\n- #self.logout()\n viewlet = self._get_viewlet()\n self.assertTrue(viewlet.show())\n \n def test_logged_users_see_byline_if_show_disabled(self):\n self.security_settings.allow_anon_views_about = False\n- #self.logout()\n viewlet = self._get_viewlet()\n self.assertTrue(viewlet.show())\n \n"

Repository: plone.app.querystring
Repository: plone.app.layout


Branch: refs/heads/master
Date: 2018-07-20T18:04:00+02:00
Author: Filippo Campi (eikichi18) <filippo.campi@redturtle.it>
Commit: https://github.com/plone/plone.app.querystring/commit/8fcf180487168194e409358debfd5556942a68b7
Date: 2018-09-04T16:33:20+02:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: https://github.com/plone/plone.app.layout/commit/60f3180365f0f2bc14960f87e676466b45494eb9

fix tests name
changelog

Files changed:
M plone/app/querystring/tests/testQueryParser.py

b"diff --git a/plone/app/querystring/tests/testQueryParser.py b/plone/app/querystring/tests/testQueryParser.py\nindex aa97525..cfe4263 100644\n--- a/plone/app/querystring/tests/testQueryParser.py\n+++ b/plone/app/querystring/tests/testQueryParser.py\n@@ -611,7 +611,7 @@ def test_getPathByUID(self):\n actual = queryparser.getPathByUID(MockSite(), '00000000000000001')\n self.assertEqual(actual, '/site/foo')\n \n- def test_objStartWithSiteId(self):\n+ def test_objStartsWithSiteId(self):\n data = Row(\n index='path',\n operator='_path',\n"

Repository: plone.app.querystring


Branch: refs/heads/master
Date: 2018-09-03T16:22:20+02:00
Author: Filippo Campi (eikichi18) <filippo.campi@redturtle.it>
Commit: https://github.com/plone/plone.app.querystring/commit/6cd37f4d8511fc7df913afc602dc76091bc0f30e

[fix] fixed check when add values to root

Files changed:
M plone/app/querystring/queryparser.py

b"diff --git a/plone/app/querystring/queryparser.py b/plone/app/querystring/queryparser.py\nindex c6fcd29..5cbf5e7 100644\n--- a/plone/app/querystring/queryparser.py\n+++ b/plone/app/querystring/queryparser.py\n@@ -291,7 +291,7 @@ def _pathByRoot(root, context, row):\n # It must be a UID\n values = getPathByUID(context, values)\n # take care of absolute paths without root\n- if not values.startswith(root + '/'):\n+ if not values.startswith(root + '/') and values != root:\n values = root + values\n query = {}\n if depth is not None:\n"

Repository: plone.app.querystring


Branch: refs/heads/master
Date: 2018-09-04T17:40:50+02:00
Author: Filippo Campi (eikichi18) <filippo.campi@redturtle.it>
Commit: https://github.com/plone/plone.app.querystring/commit/7091804b6f09591fc7a0afa7241d309819dcd460

[fix] removed useless check

Files changed:
M plone/app/querystring/queryparser.py
M CHANGES.rst

b"diff --git a/plone/app/querystring/queryparser.py b/plone/app/querystring/queryparser.py\nindex 5cbf5e7..df3d8b2 100644\n--- a/plone/app/querystring/queryparser.py\n+++ b/plone/app/querystring/queryparser.py\n@@ -278,7 +278,6 @@ def _afterRelativeDate(context, row):\n \n \n def _pathByRoot(root, context, row):\n- operator = row.operator\n values = row.values\n depth = None\n if '::' in values:\n@@ -299,8 +298,6 @@ def _pathByRoot(root, context, row):\n # when a depth value is specified, a trailing slash matters on the\n # query\n values = values.rstrip('/')\n- if operator == '_relativePath':\n- values = values.rstrip('/')\n query['query'] = [values]\n return {row.index: query}\n \n@@ -339,7 +336,7 @@ def _relativePath(context, row):\n \n row = Row(index=row.index,\n operator=row.operator,\n- values='/'.join(obj.getPhysicalPath()) + '/' + depthstr)\n+ values='/'.join(obj.getPhysicalPath()) + depthstr)\n \n return _absolutePath(context, row)\n \n"
b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 32873bb..e6d26c5 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -15,10 +15,14 @@ New features:\n \n Bug fixes:\n \n+- Show document byline for logged-in users. Fixes #160\n+ [erral]\n+\n - Get rid of obsolete ``X-UA-Compatible`` header.\n [hvelarde]\n \n \n+\n 2.8.1 (2018-06-18)\n ------------------\n \n'

Repository: plone.app.querystring
Repository: plone.app.layout


Branch: refs/heads/master
Date: 2018-09-05T09:16:31+02:00
Date: 2018-09-06T10:00:00+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/plone.app.querystring/commit/c0f0cc4337453aa809c701356110a04152e36804
Commit: https://github.com/plone/plone.app.layout/commit/18b0c8e671c0093c663dffbe9e5784a5ced016d4

Merge pull request #90 from eikichi18/filippo-fix-foldercontents-query
Merge pull request #161 from plone/erral-issue-160-document-byline

Fix foldercontents query
Fix document byline for logged-in users

Files changed:
M CHANGES.rst
M plone/app/querystring/queryparser.py
M plone/app/querystring/tests/testQueryParser.py
M plone/app/layout/viewlets/content.py
M plone/app/layout/viewlets/tests/test_content.py

b"diff --git a/CHANGES.rst b/CHANGES.rst\nindex 0d60650..05b897b 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -4,17 +4,10 @@ Changelog\n 1.4.9 (unreleased)\n ------------------\n \n-Breaking changes:\n-\n-- *add item here*\n-\n-New features:\n-\n-- *add item here*\n-\n Bug fixes:\n \n-- *add item here*\n+- Fix a case, where objects id starts with roots id\n+ [eikichi18]\n \n \n 1.4.8 (2018-02-05)\ndiff --git a/plone/app/querystring/queryparser.py b/plone/app/querystring/queryparser.py\nindex b0ae6db..df3d8b2 100644\n--- a/plone/app/querystring/queryparser.py\n+++ b/plone/app/querystring/queryparser.py\n@@ -290,7 +290,7 @@ def _pathByRoot(root, context, row):\n # It must be a UID\n values = getPathByUID(context, values)\n # take care of absolute paths without root\n- if not values.startswith(root):\n+ if not values.startswith(root + '/') and values != root:\n values = root + values\n query = {}\n if depth is not None:\ndiff --git a/plone/app/querystring/tests/testQueryParser.py b/plone/app/querystring/tests/testQueryParser.py\nindex 45a5700..cfe4263 100644\n--- a/plone/app/querystring/tests/testQueryParser.py\n+++ b/plone/app/querystring/tests/testQueryParser.py\n@@ -610,3 +610,14 @@ def test__relativePath(self):\n def test_getPathByUID(self):\n actual = queryparser.getPathByUID(MockSite(), '00000000000000001')\n self.assertEqual(actual, '/site/foo')\n+ \n+ def test_objStartsWithSiteId(self):\n+ data = Row(\n+ index='path',\n+ operator='_path',\n+ values='/{0}-news/'.format(MOCK_SITE_ID)\n+ )\n+ parsed = queryparser._absolutePath(MockSite(), data)\n+ expected = {'path': {'query': ['/{0}/{1}-news/'.format(MOCK_SITE_ID, MOCK_SITE_ID)]}}\n+ self.assertEqual(parsed, expected)\n+ \n"
b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 32873bb..e6d26c5 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -15,10 +15,14 @@ New features:\n \n Bug fixes:\n \n+- Show document byline for logged-in users. Fixes #160\n+ [erral]\n+\n - Get rid of obsolete ``X-UA-Compatible`` header.\n [hvelarde]\n \n \n+\n 2.8.1 (2018-06-18)\n ------------------\n \ndiff --git a/plone/app/layout/viewlets/content.py b/plone/app/layout/viewlets/content.py\nindex 07e262d..9651ab2 100644\n--- a/plone/app/layout/viewlets/content.py\n+++ b/plone/app/layout/viewlets/content.py\n@@ -72,7 +72,7 @@ def show(self):\n ISecuritySchema,\n prefix=\'plone\',\n )\n- return self.anonymous and settings.allow_anon_views_about\n+ return not self.anonymous or settings.allow_anon_views_about\n \n def creator(self):\n return self.context.Creator()\ndiff --git a/plone/app/layout/viewlets/tests/test_content.py b/plone/app/layout/viewlets/tests/test_content.py\nindex 6fe448a..b8914c4 100644\n--- a/plone/app/layout/viewlets/tests/test_content.py\n+++ b/plone/app/layout/viewlets/tests/test_content.py\n@@ -78,6 +78,31 @@ def test_pub_date(self):\n self.assertEqual(viewlet.pub_date(), None)\n \n \n+ def test_anonymous_users_see_byline_if_show_enabled(self):\n+ self.security_settings.allow_anon_views_about = True\n+ self.logout()\n+ viewlet = self._get_viewlet()\n+ self.assertTrue(viewlet.show())\n+\n+ def test_anonymous_users_dont_see_byline_if_show_disabled(self):\n+ self.security_settings.allow_anon_views_about = False\n+ self.logout()\n+ viewlet = self._get_viewlet()\n+ self.assertFalse(viewlet.show())\n+\n+ def test_logged_users_see_byline_if_show_enabled(self):\n+ self.security_settings.allow_anon_views_about = True\n+ viewlet = self._get_viewlet()\n+ self.assertTrue(viewlet.show())\n+\n+ def test_logged_users_see_byline_if_show_disabled(self):\n+ self.security_settings.allow_anon_views_about = False\n+ viewlet = self._get_viewlet()\n+ self.assertTrue(viewlet.show())\n+\n+\n+\n+\n class TestHistoryBylineViewletView(ViewletsTestCase):\n """\n Test the document by line viewlet\n'

0 comments on commit 419d016

Please sign in to comment.