Skip to content

Commit a51aeac

Browse files
authored
Merge pull request #8216 from 4teamwork/ran/TI-3266/pdf-save-flag
Make 'Save as PDF' into a feature flaggable action
2 parents 82a85e7 + 116b6ca commit a51aeac

File tree

11 files changed

+34
-0
lines changed

11 files changed

+34
-0
lines changed

changes/TI-3266.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Feature flag the Save as PDF action. [ran]

opengever/api/tests/test_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def test_config_contains_features(self, browser):
102102
u'repositoryfolder_tasks_tab': True,
103103
u'resolver_name': u'strict',
104104
u'sablon_date_format': u'%d.%m.%Y',
105+
u'save_as_pdf': True,
105106
u'sign': False,
106107
u'solr': True,
107108
u'tasks_pdf': False,

opengever/base/configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ def get_features(self):
176176
features['repositoryfolder_tasks_tab'] = api.portal.get_registry_record('show_tasks_tab', interface=IRepositoryFolderRecords) # noqa
177177
features['resolver_name'] = api.portal.get_registry_record('resolver_name', interface=IDossierResolveProperties)
178178
features['sablon_date_format'] = api.portal.get_registry_record('sablon_date_format_string', interface=IMeetingSettings) # noqa
179+
features['save_as_pdf'] = api.portal.get_registry_record('is_save_document_as_pdf_feature_enabled', interface=IDocumentSettings) # noqa
179180
features['solr'] = api.portal.get_registry_record('use_solr', interface=ISearchSettings)
180181
features['tasktemplatefolder_nesting'] = api.portal.get_registry_record('is_tasktemplatefolder_nesting_enabled', interface=ITaskTemplateSettings) # noqa
181182
features['error_log'] = is_redis_error_log_feature_enabled()

opengever/base/tests/test_configuration_adapter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def test_configuration(self):
9696
('repositoryfolder_tasks_tab', True),
9797
('resolver_name', 'strict'),
9898
('sablon_date_format', u'%d.%m.%Y'),
99+
('save_as_pdf', True),
99100
('solr', True),
100101
('tasktemplatefolder_nesting', False),
101102
('error_log', False),

opengever/core/upgrades/20260107083019_add_save_as_pdf_feature_flag/__init__.py

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<registry>
2+
<records interface="opengever.document.interfaces.IDocumentSettings">
3+
<value key="is_save_document_as_pdf_feature_enabled">True</value>
4+
</records>
5+
</registry>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from ftw.upgrade import UpgradeStep
2+
3+
4+
class AddSaveAsPDFFeatureFlag(UpgradeStep):
5+
"""Add save as pdf feature flag.
6+
"""
7+
8+
def __call__(self):
9+
self.install_upgrade_profile()

opengever/document/actions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from opengever.document.document import IDocumentSchema
1010
from opengever.document.interfaces import ICheckinCheckoutManager
1111
from opengever.document.interfaces import IFileActions
12+
from opengever.document.utils import is_save_as_pdf_feature_enabled
1213
from opengever.dossier.behaviors.dossier import IDossierMarker
1314
from opengever.inbox.inbox import IInbox
1415
from opengever.meeting import is_meeting_feature_enabled
@@ -295,6 +296,9 @@ def is_oneoffixx_retry_available(self):
295296
return self.file_actions.is_oneoffixx_retry_action_available()
296297

297298
def is_save_document_as_pdf_available(self):
299+
if not is_save_as_pdf_feature_enabled():
300+
return False
301+
298302
if self.is_trashed:
299303
return False
300304

opengever/document/interfaces.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ class IDocumentSettings(Interface):
9292
missing_value=[],
9393
)
9494

95+
is_save_document_as_pdf_feature_enabled = schema.Bool(
96+
title=u'Enable Save as PDF Feature',
97+
description=u'Allows users to save documents as pdfs',
98+
default=True)
99+
95100

96101
class ICheckinCheckoutManager(Interface):
97102
"""Interface for the checkin / checkout manager.

opengever/document/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from opengever.document.interfaces import IDocumentSettings
2+
from plone import api
3+
4+
5+
def is_save_as_pdf_feature_enabled():
6+
return api.portal.get_registry_record('is_save_document_as_pdf_feature_enabled', interface=IDocumentSettings) # noqa

0 commit comments

Comments
 (0)