GenericSetup
De-mystified
      Clayton Parker
Plone Symposium East 2009




            nowhere to go but
           open ...
Who am I?


•   Lead Developer at Six Feet Up, Inc.
•   claytron on IRC




                                          s ix...
What’s in store?

•   The what and why of GenericSetup
•   Importing and exporting
•   Best practices
•   portal_setup vs....
What?

•   portal_quickinstaller replacement
•   CustomizationPolicy replacement
•   Site configuration
•   Upgrades




  ...
Why?


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




                                  ...
Install.py == sadness


                    s ixf eet up. c om/ i mme r se
GenericSetup Profiles


•   Base profile
•   Extension profile




                       s ixf eet up. c om/ i mme r se
What’s in a profile?
    <genericsetup:registerProfile
        name=quot;defaultquot;
        title=quot;My Packagequot;
  ...
On the filesystem
   my.package/my/package/
    |
    |- configure.zcml
    |- exportimport/
    |
    |- profiles/
    |  ...
s ixf eet up. c om/ i mme r se
s ixf eet up. c om/ i mme r se
s ixf eet up. c om/ i mme r se
s ixf eet up. c om/ i mme r se
s ixf eet up. c om/ i mme r se
metadata.xml
<?xml version=quot;1.0quot;?>
<metadata>
  <version>1.0</version>
  <dependencies>
    <dependency>profile-my...
s ixf eet up. c om/ i mme r se
Careful with that axe, Eugene...




                                   s ixf eet up. c om/ i mme r se
s ixf eet up. c om/ i mme r se
Tell me more


•   Profile for initial site setup
•   Upgrade steps




                                    s ixf eet up. c...
Upgrade steps
   <genericsetup:upgradeStep
       title=quot;Setup calendarquot;
       description=quot;Modify the calend...
Upgrade steps
 from Products.CMFCore.utils import getToolByName

 def setupCalendar(context):
     ctool = getToolByName(c...
Best Practices

•   Uninstall profiles
•   Trim the export
•   Be aware of other profiles




                              ...
<property name=quot;metaTypesNotToListquot; type=quot;linesquot;>
        <element value=quot;ATBooleanCriterionquot;/>
  ...
portal_setup vs. portal_quickinstaller




                                     s ixf eet up. c om/ i mme r se
def install(portal):
    quot;quot;quot;Run the GS profile to install this packagequot;quot;quot;
    out = StringIO()
   ...
Make me a Zope 2 style product

<five:registerPackage package=quot;.quot; initialize=quot;.initializequot;/>




         ...
What did we learn?

•   The what and why of GenericSetup
•   Importing and exporting
•   Best practices
•   portal_setup v...
Links


•   http://www.sixfeetup.com/swag/generic-setup-quick-reference-card
•   http://plone.org/documentation/manual/gen...
Learn Plone by building a website from A to Z
1 non-profit project • 10 workshops • 14 mentors • 3 days


      s ixf eetup...
Upcoming SlideShare
Loading in...5
×

Generic Setup De-Mystified

1,312

Published on

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.

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total Views
1,312
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Generic Setup De-Mystified

  1. 1. GenericSetup De-mystified Clayton Parker Plone Symposium East 2009 nowhere to go but open source s ix fe e tup . co m / i mm e rs e
  2. 2. Who am I? • Lead Developer at Six Feet Up, Inc. • claytron on IRC s ixf eet up. c om/ i mme r se
  3. 3. What’s in store? • The what and why of GenericSetup • Importing and exporting • Best practices • portal_setup vs. portal_quickinstaller s ixf eet up. c om/ i mme r se
  4. 4. What? • portal_quickinstaller replacement • CustomizationPolicy replacement • Site configuration • Upgrades s ixf eet up. c om/ i mme r se
  5. 5. Why? “Persistence means always having to say you’re sorry” - Seaver’s Law s ixf eet up. c om/ i mme r se
  6. 6. Install.py == sadness s ixf eet up. c om/ i mme r se
  7. 7. GenericSetup Profiles • Base profile • Extension profile s ixf eet up. c om/ i mme r se
  8. 8. What’s in a profile? <genericsetup:registerProfile name=quot;defaultquot; title=quot;My Packagequot; directory=quot;profiles/defaultquot; description=quot;My Package install profilequot; provides=quot;Products.GenericSetup.interfaces.EXTENSIONquot; /> • profile-<package_name>:<profile_name> • profile-my.package:default • my.package:default s ixf eet up. c om/ i mme r se
  9. 9. On the filesystem my.package/my/package/ | |- configure.zcml |- exportimport/ | |- profiles/ | | | |- default/ | | | |- metadata.xml | |- my.package-default.txt | |- <other profile files> | |- setuphandlers.py |- upgrades.py s ixf eet up. c om/ i mme r se
  10. 10. s ixf eet up. c om/ i mme r se
  11. 11. s ixf eet up. c om/ i mme r se
  12. 12. s ixf eet up. c om/ i mme r se
  13. 13. s ixf eet up. c om/ i mme r se
  14. 14. s ixf eet up. c om/ i mme r se
  15. 15. metadata.xml <?xml version=quot;1.0quot;?> <metadata> <version>1.0</version> <dependencies> <dependency>profile-my.theme:default</dependency> <dependency>profile-my.other.package:default</dependency> </dependencies> </metadata> s ixf eet up. c om/ i mme r se
  16. 16. s ixf eet up. c om/ i mme r se
  17. 17. Careful with that axe, Eugene... s ixf eet up. c om/ i mme r se
  18. 18. s ixf eet up. c om/ i mme r se
  19. 19. Tell me more • Profile for initial site setup • Upgrade steps s ixf eet up. c om/ i mme r se
  20. 20. Upgrade steps <genericsetup:upgradeStep title=quot;Setup calendarquot; description=quot;Modify the calendar settingsquot; source=quot;0.9quot; destination=quot;1.0quot; handler=quot;.upgrades.setupCalendarquot; sortkey=quot;10quot; profile=quot;my.package:defaultquot; /> s ixf eet up. c om/ i mme r se
  21. 21. 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 s ixf eet up. c om/ i mme r se
  22. 22. Best Practices • Uninstall profiles • Trim the export • Be aware of other profiles s ixf eet up. c om/ i mme r se
  23. 23. <property name=quot;metaTypesNotToListquot; type=quot;linesquot;> <element value=quot;ATBooleanCriterionquot;/> <element value=quot;ATDateCriteriaquot;/> <element value=quot;ATDateRangeCriterionquot;/> <element value=quot;ATListCriterionquot;/> ... </property> <property name=quot;metaTypesNotToListquot; type=quot;linesquot; purge=quot;Falsequot;> <element value=quot;Imagequot;/> <element value=quot;Filequot;/> </property> s ixf eet up. c om/ i mme r se
  24. 24. portal_setup vs. portal_quickinstaller s ixf eet up. c om/ i mme r se
  25. 25. def install(portal): quot;quot;quot;Run the GS profile to install this packagequot;quot;quot; out = StringIO() runProfile(portal, 'profile-my.package:default') print >>out, quot;Installed my.packagequot; return out.getvalue() def uninstall(portal, reinstall=False): quot;quot;quot;Run the GS profile to install this packagequot;quot;quot; out = StringIO() if not reinstall: runProfile(portal, 'profile-my.package:uninstall') print >>out, quot;Uninstalled my.packagequot; return out.getvalue() s ixf eet up. c om/ i mme r se
  26. 26. Make me a Zope 2 style product <five:registerPackage package=quot;.quot; initialize=quot;.initializequot;/> s ixf eet up. c om/ i mme r se
  27. 27. What did we learn? • The what and why of GenericSetup • Importing and exporting • Best practices • portal_setup vs. portal_quickinstaller s ixf eet up. c om/ i mme r se
  28. 28. Links • http://www.sixfeetup.com/swag/generic-setup-quick-reference-card • http://plone.org/documentation/manual/generic-setup/ s ixf eet up. c om/ i mme r se
  29. 29. Learn Plone by building a website from A to Z 1 non-profit project • 10 workshops • 14 mentors • 3 days s ixf eetup. com/im merse Register by June 30th and save $255!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×