Skip to content

Commit

Permalink
WCM-392: Remove toggle which overrides the access property
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspuppe committed Sep 19, 2024
1 parent 3450f30 commit a184587
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
10 changes: 1 addition & 9 deletions core/src/zeit/content/article/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@
</article>"""


class ToggleableAccess(zeit.cms.content.dav.DAVProperty):
def __get__(self, instance, class_, properties=None):
value = super().__get__(instance, class_, properties)
if FEATURE_TOGGLES.find('access_treat_free_as_dynamic') and value == 'free':
return 'dynamic'
return value


@zope.interface.implementer(
zeit.content.article.interfaces.IArticle, zeit.cms.interfaces.IEditorialContent
)
Expand Down Expand Up @@ -97,7 +89,7 @@ class Article(zeit.cms.content.metadata.CommonMetadata):
),
)

access = ToggleableAccess(
access = zeit.cms.content.dav.DAVProperty(
ICommonMetadata['access'],
zeit.cms.interfaces.DOCUMENT_SCHEMA_NS,
'access',
Expand Down
11 changes: 0 additions & 11 deletions core/src/zeit/content/article/tests/test_article.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,6 @@ def test_no_checksum_for_ignored_genres(self):
assert not checksum.checksum


class ArticleAccess(zeit.content.article.testing.FunctionalTestCase):
def test_free_is_treated_as_dynamic_according_to_toggle(self):
article = self.repository['article'] = self.get_article()
with zeit.cms.checkout.helper.checked_out(article) as co:
co.access = 'free'
article = self.repository['article']
self.assertEqual('free', article.access)
FEATURE_TOGGLES.set('access_treat_free_as_dynamic')
self.assertEqual('dynamic', article.access)


class AudioArticle(zeit.content.article.testing.FunctionalTestCase):
def _add_audio_to_article(self):
self.repository['article'] = self.article
Expand Down

0 comments on commit a184587

Please sign in to comment.