generic setup de-mystified

29
open source nowhere to go but sixfeetup.com/immerse GenericSetup De-mystified Clayton Parker Plone Symposium East 2009

Upload: clayton-parker

Post on 17-Dec-2014

1.257 views

Category:

Technology


0 download

DESCRIPTION

A talk focusing on the GenericSetup tool and it's use in Plone. NOTE: There were a couple screencasts that won't transfer to the slides.

TRANSCRIPT

Page 1: Generic Setup De-Mystified

open sourcenowhere to go but

sixfeetup.com/immerse

GenericSetupDe-mystified

Clayton ParkerPlone Symposium East 2009

Page 2: Generic Setup De-Mystified

sixfeetup.com/immerse

Who am I?

• Lead Developer at Six Feet Up, Inc.

• claytron on IRC

Page 3: Generic Setup De-Mystified

sixfeetup.com/immerse

What’s in store?

• The what and why of GenericSetup

• Importing and exporting

• Best practices

• portal_setup vs. portal_quickinstaller

Page 4: Generic Setup De-Mystified

sixfeetup.com/immerse

What?

• portal_quickinstaller replacement

• CustomizationPolicy replacement

• Site configuration

• Upgrades

Page 5: Generic Setup De-Mystified

sixfeetup.com/immerse

Why?

“Persistence means always having tosay you’re sorry” - Seaver’s Law

Page 6: Generic Setup De-Mystified

sixfeetup.com/immerse

Install.py == sadness

Page 7: Generic Setup De-Mystified

sixfeetup.com/immerse

GenericSetup Profiles

• Base profile

• Extension profile

Page 8: Generic Setup De-Mystified

sixfeetup.com/immerse

What’s in a profile?

• profile-<package_name>:<profile_name>

• profile-my.package:default

• my.package:default

<genericsetup:registerProfile name="default" title="My Package" directory="profiles/default" description="My Package install profile" provides="Products.GenericSetup.interfaces.EXTENSION" />

Page 9: Generic Setup De-Mystified

sixfeetup.com/immerse

On the filesystemmy.package/my/package/ | |- configure.zcml |- exportimport/ | |- profiles/ | | | |- default/ | | | |- metadata.xml | |- my.package-default.txt | |- <other profile files> | |- setuphandlers.py |- upgrades.py

Page 10: Generic Setup De-Mystified

sixfeetup.com/immerse

Page 11: Generic Setup De-Mystified

sixfeetup.com/immerse

Page 12: Generic Setup De-Mystified

sixfeetup.com/immerse

Page 13: Generic Setup De-Mystified

sixfeetup.com/immerse

Page 14: Generic Setup De-Mystified

sixfeetup.com/immerse

Page 15: Generic Setup De-Mystified

sixfeetup.com/immerse

metadata.xml

<?xml version="1.0"?><metadata> <version>1.0</version> <dependencies> <dependency>profile-my.theme:default</dependency> <dependency>profile-my.other.package:default</dependency> </dependencies></metadata>

Page 16: Generic Setup De-Mystified

sixfeetup.com/immerse

Page 17: Generic Setup De-Mystified

sixfeetup.com/immerse

Careful with that axe, Eugene...

Page 18: Generic Setup De-Mystified

sixfeetup.com/immerse

Page 19: Generic Setup De-Mystified

sixfeetup.com/immerse

Tell me more

• Profile for initial site setup

• Upgrade steps

Page 20: Generic Setup De-Mystified

sixfeetup.com/immerse

Upgrade steps

<genericsetup:upgradeStep title="Setup calendar" description="Modify the calendar settings" source="0.9" destination="1.0" handler=".upgrades.setupCalendar" sortkey="10" profile="my.package:default" />

Page 21: Generic Setup De-Mystified

sixfeetup.com/immerse

Upgrade steps

from Products.CMFCore.utils import getToolByName

def setupCalendar(context): ctool = getToolByName(context, 'portal_calendar') cal_types = list(ctool.calendar_types) if 'MyEventType' not in cal_types: cal_types.append('MyEventType') ctool.calendar_types = cal_types

Page 22: Generic Setup De-Mystified

sixfeetup.com/immerse

Best Practices

• Uninstall profiles

• Trim the export

• Be aware of other profiles

Page 23: Generic Setup De-Mystified

sixfeetup.com/immerse

<property name="metaTypesNotToList" type="lines"> <element value="ATBooleanCriterion"/> <element value="ATDateCriteria"/> <element value="ATDateRangeCriterion"/> <element value="ATListCriterion"/> ...</property>

<property name="metaTypesNotToList" type="lines" purge="False"> <element value="Image"/> <element value="File"/></property>

Page 24: Generic Setup De-Mystified

sixfeetup.com/immerse

portal_setup vs. portal_quickinstaller

Page 25: Generic Setup De-Mystified

sixfeetup.com/immerse

def install(portal): """Run the GS profile to install this package""" out = StringIO() runProfile(portal, 'profile-my.package:default') print >>out, "Installed my.package" return out.getvalue()

def uninstall(portal, reinstall=False): """Run the GS profile to install this package""" out = StringIO() if not reinstall: runProfile(portal, 'profile-my.package:uninstall') print >>out, "Uninstalled my.package" return out.getvalue()

Page 26: Generic Setup De-Mystified

sixfeetup.com/immerse

<five:registerPackage package="." initialize=".initialize"/>

Make me a Zope 2 style product

Page 27: Generic Setup De-Mystified

sixfeetup.com/immerse

What did we learn?

• The what and why of GenericSetup

• Importing and exporting

• Best practices

• portal_setup vs. portal_quickinstaller

Page 28: Generic Setup De-Mystified

sixfeetup.com/immerse

Links

• http://www.sixfeetup.com/swag/generic-setup-quick-reference-card

• http://plone.org/documentation/manual/generic-setup/

Page 29: Generic Setup De-Mystified

sixfeetup.com/immerseRegister by June 30th

and save $255!

1 non-profit project • 10 workshops • 14 mentors • 3 days

Learn Plone by building a website from A to Z