Skip to content

Commit

Permalink
rename atct_album_view to folder_album_view
Browse files Browse the repository at this point in the history
  • Loading branch information
pbauer committed Mar 29, 2014
1 parent 0b6631e commit 0fdfe0f
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 7 deletions.
2 changes: 1 addition & 1 deletion plone/app/contenttypes/browser/album_view.py
Expand Up @@ -8,7 +8,7 @@

class AlbumView(BrowserView):

template = ViewPageTemplateFile('templates/atct_album_view.pt')
template = ViewPageTemplateFile('templates/folder_album_view.pt')

def getAlbumContent(self,
container=None,
Expand Down
4 changes: 2 additions & 2 deletions plone/app/contenttypes/browser/configure.zcml
Expand Up @@ -184,11 +184,11 @@
/>

<browser:page
name="atct_album_view"
name="folder_album_view"
for="plone.dexterity.interfaces.IDexterityContainer"
layer="plone.app.contenttypes.interfaces.IPloneAppContenttypesLayer"
class=".album_view.AlbumView"
template="templates/atct_album_view.pt"
template="templates/folder_album_view.pt"
permission="zope2.View"
menu="plone_displayviews"
title="Album"
Expand Down
4 changes: 4 additions & 0 deletions plone/app/contenttypes/migration/migration.py
Expand Up @@ -422,6 +422,10 @@ class FolderMigrator(ATCTFolderMigrator):
dst_portal_type = 'Folder'
dst_meta_type = None # not used

def beforeChange_migrate_layout(self):
if self.old.getLayout() == 'atct_album_view':
self.old.setLayout('folder_album_view')


def migrate_folders(portal):
return migrate(portal, FolderMigrator)
Expand Down
2 changes: 1 addition & 1 deletion plone/app/contenttypes/profiles/default/types/Folder.xml
Expand Up @@ -17,7 +17,7 @@
<element value="folder_summary_view"/>
<element value="folder_full_view"/>
<element value="folder_tabular_view"/>
<element value="atct_album_view"/>
<element value="folder_album_view"/>
<element value="folder_listing"/>
</property>
<property name="default_view_fallback">False</property>
Expand Down
2 changes: 1 addition & 1 deletion plone/app/contenttypes/profiles/uninstall/types/Folder.xml
Expand Up @@ -19,7 +19,7 @@
<element value="folder_summary_view"/>
<element value="folder_full_view"/>
<element value="folder_tabular_view"/>
<element value="atct_album_view"/>
<element value="folder_album_view"/>
<element value="folder_listing"/>
</property>
<alias from="(Default)" to="(dynamic view)"/>
Expand Down
4 changes: 2 additions & 2 deletions plone/app/contenttypes/tests/test_folder.py
Expand Up @@ -133,7 +133,7 @@ def test_folder_tabular_view(self):
self.assertTrue('My Folder' in self.browser.contents)
self.assertTrue('Document 1' in self.browser.contents)

def test_atct_album_view(self):
self.browser.open(self.folder_url + '/atct_album_view')
def test_folder_album_view(self):
self.browser.open(self.folder_url + '/folder_album_view')
self.assertTrue('My Folder' in self.browser.contents)
self.assertTrue('Document 1' in self.browser.contents)
2 changes: 2 additions & 0 deletions plone/app/contenttypes/tests/test_migration.py
Expand Up @@ -911,12 +911,14 @@ def test_folder_is_migrated(self):
from plone.app.contenttypes.interfaces import IFolder
self.portal.invokeFactory('Folder', 'folder')
at_folder = self.portal['folder']
at_folder.setLayout('atct_album_view')
applyProfile(self.portal, 'plone.app.contenttypes:default')
migrator = self.get_migrator(at_folder, FolderMigrator)
migrator.migrate()
dx_folder = self.portal['folder']
self.assertTrue(IFolder.providedBy(dx_folder))
self.assertTrue(at_folder is not dx_folder)
self.assertEqual(dx_folder.getLayout(), 'folder_album_view')

def test_folder_children_are_migrated(self):
from plone.app.contenttypes.migration.migration import FolderMigrator
Expand Down
18 changes: 18 additions & 0 deletions plone/app/contenttypes/upgrades.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from Products.CMFCore.utils import getToolByName
from plone.dexterity.interfaces import IDexterityFTI
from zope.component import queryUtility

Expand Down Expand Up @@ -67,3 +68,20 @@ def migrate_to_richtext(context):
'profile-plone.app.contenttypes:default',
'typeinfo',
)


def migrate_album_view(context):
"""Migrate Folders name view"""

# allow folder_album_view for the types
context.runImportStepFromProfile(
'profile-plone.app.contenttypes:default',
'typeinfo',
)
catalog = getToolByName(context, 'portal_catalog')
search = catalog.unrestrictedSearchResults
for brain in search(portal_type='Folder'):
obj = brain.getObject()
current = context.getLayout()
if current == 'atct_album_view':
obj.setLayout('folder_album_view')
9 changes: 9 additions & 0 deletions plone/app/contenttypes/upgrades.zcml
Expand Up @@ -42,4 +42,13 @@
handler=".upgrades.migrate_to_richtext"
/>

<genericsetup:upgradeStep
source="1101"
destination="1102"
title="Update album_view"
description=""
profile="plone.app.contenttypes:default"
handler=".upgrades.migrate_album_view"
/>

</configure>

1 comment on commit 0fdfe0f

@mister-roboto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TESTS PASSED
Mr.Roboto url : http://jenkins.plone.org/roboto/get_info?push=560d4462d8f947dea2daeb09b4d940fb
plone-5.0-python-2.7 [SUCCESS]
plone-4.3-python-2.6 [SUCCESS]
plone-4.3-python-2.7 [SUCCESS]

Please sign in to comment.