tips for migrating apps to plone 3

29
Six Feet Up, Inc. http://www.sixfeetup.com Silicon Valley • Midwest 10.11.2007 Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker Tips for Migrating Apps to Plone 3

Upload: calvin-hendryx-parker

Post on 04-Dec-2014

4.687 views

Category:

Technology


2 download

DESCRIPTION

Plone has undergone several rounds of changes and developers need to make sure their applications evolve with it in a graceful manner. Review powerful new tools that have been created to ease Plone development. Learn how your products can take advantage of Plone 3's improved user-experience.Unleash the power of Zope 3 using Five to utilize views, viewlets, events and utilities. Learn how to leverage migration steps in GenericSetup. Find out what methods are now deprecated in Plone 3.Developers will walk away with the knowledge needed to keep their applications current.

TRANSCRIPT

Page 1: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

Tips for Migrating Apps to Plone 3

Page 2: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

Questions?

Page 3: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

How Do We Get There?

Page 4: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

Zope Won’t Start

Page 5: Tips For Migrating Apps To Plone 3

10.11.2007

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

• Products.CMFCore.CMFPermissions

Products.CMFCore.permissions

• Products.CMFPlone.utils.BrowserView

Products.Five.BrowserView

• toPortalTime finally gone

• toLocalizedTime now in the @@plone view

Deprecated Methods and Imports

Page 6: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

Getting Current

Page 7: Tips For Migrating Apps To Plone 3

10.11.2007

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

• Remove Sharing Tab

• Remove Properties Tab

• Add Lock Awareness to the Edit Tab

condition_expr="not:object/@@plone_lock_info/is_locked_for_current_user|python:True"

Update your type info

Page 8: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

Life Changing Decisions

Page 9: Tips For Migrating Apps To Plone 3

10.11.2007

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

• View Classes

• Create Utilities instead of Portal Tools

• Use MenuItems to add custom Actions

• Zope 3 Events

manage_afterAdd

manage_beforeDelete

Taking Advantage of Zope 3

Page 10: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

ZCML

Page 11: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

<configure xmlns="http://namespaces.zope.org/zope">

<subscriber for="Products.OER.interfaces.IOERItem OFS.interfaces.IObjectWillBeRemovedEvent" handler=".subscribers.deleteSubmissions"/>

<subscriber for="Products.OER.interfaces.IOERTag zope.app.event.interfaces.IObjectModifiedEvent" handler=".subscribers.checkTags"/>

<subscriber for="Products.OER.interfaces.IOERSubmission OFS.interfaces.IObjectWillBeAddedEvent" handler=".subscribers.changeStateHomeFolder"/>

</configure>

Page 12: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

def deleteSubmissions(self, event): """ Delete the submissions attached to the object we just come from deleting """ item = event.object

# we delete the tags/ratings/reviews/notes associated with this item ps = getToolByName(self, 'portal_submissions') pc = getToolByName(self, 'portal_catalog')

targets = ps.getTargets(item) ...

Page 13: Tips For Migrating Apps To Plone 3

10.11.2007

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

• Replaces Customization Policies

• Replaces the old Install.py for QuickInstaller

• Upgrade Steps

Versatile One Time Steps

GenericSetup

Page 14: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

<configure xmlns="http://namespaces.zope.org/zope" xmlns:genericsetup="http://namespaces.zope.org/genericsetup" i18n_domain="plone">

<genericsetup:registerProfile name="default" title="AdvancedDocument Profile" directory="profiles/default" description="Extension profile for the AdvancedDocument Product" provides="Products.GenericSetup.interfaces.EXTENSION" />

<genericsetup:upgradeStep title="Update Catalog" description="Update the Catalog" source="0.4" destination="0.5" handler="Products.AdvancedDocument.upgrades.updatecatalog.updateCatalog" sortkey="1" profile="Products.AdvancedDocument:default" /></configure>

Page 15: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

Page 16: Tips For Migrating Apps To Plone 3

10.11.2007

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

Setting up Versioning• GenericSetup export/import broken

• Setup via a setup handler

• Register via your product

Page 17: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

<?xml version="1.0"?><import-steps>

<import-step id="versioningsetup" version="20070828-01" handler="Products.AdvancedDocument.exportimport.versioningsetup.versioningSetup" title="Versioning Setup"> <dependency step="content"/> Add versioning on our selected content types </import-step> </import-steps>

Page 18: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

def versioningSetup(context): """Setup portal_factory """ site = context.getSite()

portal_repository = getToolByName(site, 'portal_repository') portal_diff = getToolByName(site, 'portal_diff') versionable_types = list(portal_repository.getVersionableContentTypes()) type_ids = ['AdvancedDocument', ] for type_id in type_ids: if type_id not in versionable_types: versionable_types.append(type_id) for policy_id in DEFAULT_POLICIES: portal_repository.addPolicyForContentType(type_id, policy_id) diff_res = portal_diff.getDiffForPortalType(type_id) if not diff_res: portal_diff.manage_addDiffField(type_id, 'any', 'Compound Diff for AT types')

portal_repository.setVersionableContentTypes(versionable_types)

Page 19: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

People Skills

Page 20: Tips For Migrating Apps To Plone 3

10.11.2007

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

• PAS added as default in 2.5

• GRUF completely removed in 3.0

• User and Group Searching Done via PAS directly

GRUF and PAS

Page 21: Tips For Migrating Apps To Plone 3

10.11.2007

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

• Reader

• Editor

• Contributor

Add your custom add permissions to this role

New Roles

Page 22: Tips For Migrating Apps To Plone 3

10.11.2007

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

• Viewlets

• Viewlet Manager

• Classic Portlet

Performance Issues

left and right slots properties gone

Portlets

Page 23: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

<configure xmlns="http://namespaces.zope.org/zope" xmlns:plone="http://namespaces.plone.org/plone"> <plone:portlet name="portlets.Ads" interface=".portlets.ads.IAdPortlet" assignment=".portlets.ads.Assignment" renderer=".portlets.ads.Renderer" addview=".portlets.ads.AddForm" editview=".portlets.ads.EditForm" />

</configure>

Page 24: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

Leverage Other New Features

Page 25: Tips For Migrating Apps To Plone 3

10.11.2007

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

• textile

• markdown

• wiki style linking

Additional Markup and Field Support

Page 26: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

Don’t Forget the Basics

Page 27: Tips For Migrating Apps To Plone 3

10.11.2007

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

• ExtendedPathIndex

• New Date Indexes

Catalog Enhancements

Page 28: Tips For Migrating Apps To Plone 3

10.11.2007

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

• CSS

• Javascript

Leverage the Registries

Page 29: Tips For Migrating Apps To Plone 3

Six Feet Up, Inc. • http://www.sixfeetup.com Silicon Valley • Midwest

10.11.2007Tips for Migrating Apps to Plone 3 - Calvin Hendryx-Parker

Questions?