Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use behavior-names instead of python-paths in types-controlpanel #3294

Merged
merged 5 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Products/CMFPlone/controlpanel/browser/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TypesControlPanel(AutoExtensibleForm, form.EditForm):
form_name = _("Types settings")
control_panel_view = "content-controlpanel"
template = ViewPageTemplateFile('types.pt')
behavior_name = 'plone.app.versioningbehavior.behaviors.IVersionable'
behavior_name = 'plone.versioning'

@button.buttonAndHandler(_('Save'), name='save')
def handleSave(self, action):
Expand Down Expand Up @@ -94,7 +94,7 @@ def add_versioning_behavior(self, fti):
if self.behavior_name not in behaviors:
behaviors.append(self.behavior_name)
# locking must be turned on for versioning support on the type
locking = 'plone.app.lockingbehavior.behaviors.ILocking'
locking = 'plone.locking'
if locking not in behaviors:
behaviors.append(locking)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_disable_versioning_removes_behavior(self):
portal_types = self.portal.portal_types
doc_type = portal_types.Document
self.assertTrue(
'plone.app.versioningbehavior.behaviors.IVersionable'
'plone.versioning'
not in doc_type.behaviors) # noqa

def test_enable_versioning_behavior_on_document(self):
Expand All @@ -127,14 +127,14 @@ def test_enable_versioning_behavior_on_document(self):
portal_types = self.portal.portal_types
doc_type = portal_types.Document
self.assertTrue(
'plone.app.versioningbehavior.behaviors.IVersionable'
'plone.versioning'
not in doc_type.behaviors) # noqa

self.browser.getControl(name='versionpolicy').value = ['manual']
self.browser.getControl(name="form.button.Save").click()

self.assertTrue(
'plone.app.versioningbehavior.behaviors.IVersionable'
'plone.versioning'
in doc_type.behaviors)

def test_enable_versioning_behavior_on_file(self):
Expand All @@ -149,20 +149,20 @@ def test_enable_versioning_behavior_on_file(self):

# File has no Versioning and no Locking on default, but needs it
self.assertTrue(
'plone.app.versioningbehavior.behaviors.IVersionable'
'plone.versioning'
not in file_type.behaviors) # noqa
self.assertTrue(
'plone.app.lockingbehavior.behaviors.ILocking'
'plone.locking'
not in file_type.behaviors) # noqa

self.browser.getControl(name='versionpolicy').value = ['manual']
self.browser.getControl('Save').click()

self.assertTrue(
'plone.app.versioningbehavior.behaviors.IVersionable'
'plone.versioning'
in file_type.behaviors)
self.assertTrue(
'plone.app.lockingbehavior.behaviors.ILocking'
'plone.locking'
in file_type.behaviors)

def test_dont_update_settings_when_switch_types(self):
Expand Down
2 changes: 2 additions & 0 deletions news/3294.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Use behavior-names instead of python-paths in types-controlpanel
[pbauer]