Plone For Developers - World Plone Day, 2009
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Plone For Developers - World Plone Day, 2009

  • 1,229 views
Uploaded on

Core Software Group and the Denver Plone Users Group hosted the Denver World Plone Day on April 22, 2009 at the Tivoli Center in downtown Denver. The presentation was given by Chris Crownhart and......

Core Software Group and the Denver Plone Users Group hosted the Denver World Plone Day on April 22, 2009 at the Tivoli Center in downtown Denver. The presentation was given by Chris Crownhart and talked about Core Software Group's custom development techniques for some of the Plone sites we have built.

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,229
On Slideshare
1,225
From Embeds
4
Number of Embeds
2

Actions

Shares
Downloads
11
Comments
0
Likes
0

Embeds 4

http://www.slideshare.net 3
http://www.lmodules.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. P LONE FOR D EVELOPERS E XTENDING AND M ODIFYING P LONE
  • 2. W HO AM I?  W HO ARE WE ?
    • Chris Crownhart, Founder, President, Senior Software Engineer at Core Software Group In business since 1999, working with Plone since 2003, Zope since 2000 Core Software Group has grown its client base over 
    • the years and now provides development, integration, 
    • support, and hosting for over 30 different 
    • organizations and websites. The Core Software Group team is 3 people - 
    • Chris Crownhart, Justin English, and Mike Cullerton
  • 3. I NSTALLING P LONE
    • Mac Installer, Windows Installer, Unified Installer
    • The Mac and Windows Installers provide installer GUI's, but still create a buildout-based environment.
    • Unified Installer vs. paster
      • The Unified Installer creates a buildoutenvironment for you, with a few commandline options. paster creates a very similar environment, but uses ZopeSkeltemplates. 
  • 4. E ASILY E XTENDING P LONE
    • Download Products
    • http://plone.org/productshttp://pypi.python.org/pypi
    • i.e. PloneFormGen, PloneSurvey, 
    • Scrawl, SimpleBlog, Ploneboard, etc...
    • Currently, on plone.org, there are 
    • 957 projects with a total of 2531 
    • releases available.
  • 5. G ETTING S TARTED WITH C USTOM D EV
    • My good friend, the command line: bin/instance fg
    • The ZMI - http://localhost:8080/manage
    • Useful 'tools' in the ZMI
    • portal_types portal_workflow portal_css portal_javascripts
    • When do I restart Zope?
    • Other: debug-mode on, 
    •      tail -f var/log/instance.log
  • 6. C USTOM C ONTENT T YPES
    • Archetypes
    • Fields
    • StringField, BooleanField, DateTimeField, LinesField,ReferenceField, ImageField, etc...
    • Widgets
    • StringWidget, SelectionWidget, RichWidget,ReferenceBrowserWidget, etc...
  • 7. C USTOM C ONTENT T YPES
    • Archetypes Field, an example:
    •       atapi.LinesField(
    •          name='county',
    •          index='FieldIndex',
    •          required=False,
    •          searchable=True,
    •          widget=atapi.LinesWidget(
    •              label='County',
    •              description='Enter the county(ies), one per line,'
    •          ),
    •      ),
    •     
  • 8. C USTOM C ONTENT T YPES
    • Archetypes Field, another example:
    •      atapi.BooleanField(
    •          name='available',
    •          required=True,
    •          searchable=True,
    •          default=True,
    •          widget=atapi.BooleanWidget(
    •              label='Available to all users?',
    •              description='Uncheck this box to make this template advocate-only',
    •              format='checkbox'
    •          ),
    •      ),
    •    
  • 9. C REATING C USTOM P RODUCTS
    • aka, "Development Eggs"
      • paster create --list-templates
      • paster create -t plone3_buildout
      • paster create -t archetype
      • paster addcontent MyType
      • paster addcontent --list
      • paster addcontent atschema
    •    
  • 10. SQL D ATABASES
    • Quite often it is not enough: 
    • to just use the content types in Plone  and the object database in Zope.
    • In those circumstances, you can use:
    • SQLStorage Custom ZSQL
  • 11. SQL D ATABASES - SQLS TORAGE
    • The SQLStorage storage for Archetypes allows you to transparently store attributes of your Archetypes objects in an SQL-backed database.  The SQLStorage product works for MySQL and PostgreSQL.
    •    from Products.Archetypes.SQLStorage import MySQLSQLStorage
    •       
    •    StringField('address_line_1',
    •                required=1,
    •                searchable=0,
    •                default='',  
    •                mutator='setAddress_line_1',
    •                widget=StringWidget(label='Address Line 1', 
    •                       description='Address Line 1.',maxlength=50,size=30),
    •                storage=MySQLSQLStorage()
    •    )
    •          class Customer(BaseFolder):
  • 12. SQL D ATABASES - SQLS TORAGE
    • Sample code:
    •    from Products.Archetypes.SQLStorage import MySQLSQLStorage
    •       
    •    StringField('address_line_1',
    •                required=1,
    •                searchable=0,
    •                mutator='setAddress_line_1',
    •                widget=StringWidget(label='Address Line 1', 
    •                       description='Address Line 1.',maxlength=50,size=30),
    •                storage=MySQLSQLStorage()
    •    )
    •    class Customer(BaseFolder):
    • When the content  type is installed, a table is created called 'Customer' with a column called 'address_line_1'
  • 13. SQL D ATABASES - C USTOM ZSQL
    • For a recent project, we needed to pull read-only data from a PostgreSQL database and display it in a Plone site.
    • We chose to implement a simple 'wrapper' archetype (called 'Attraction') that pulled the instance data from PostgreSQL.
    • An instance of the content type was created for each row
    • in the database table.
    • The SQL data was all searchable through
    • Plone' portal_catalog.
  • 14. SQL D ATABASES - C USTOM ZSQL
    • First, we created a simple Schema with:
    • StringField('pgid',
    •    index = 'FieldIndex',
    •   searchable = 1,
    •   required = 1,
    •   widget = StringWidget(label = 'PGID'),
    • ),
    • Then, to retrieve data, we wrote an accessor:
    • def getCounty(self):
    •    if self.pgid != '':
    •      return self.select_from_sites_by_siteid(
    •                              siteid=self.pgid)[0]['countyid']
    •    return
  • 15. SQL D ATABASES - C USTOM ZSQL
    • In order for the catalog to search the Attractions:
    • def SearchableText(self): if self.pgid != '': siteid = int(self.pgid) site_desc = short_desc = city = directions = '' list_of_data = self.select_from_sites_by_siteid(siteid=siteid) for row in list_of_data: if row['sitedesc']: site_desc = row['sitedesc'] if row['shortdesc']: short_desc = row['shortdesc'] if row['city']: city = row['city'] if row['directions']: directions = row['directions'] return site_desc + ' ' + short_desc + ' ' + 
    •                                    city + ' ' + directions + self.Title() return self.Title()
  • 16. W E COULD GO ON AND ON AND ON AND ...
    • But that is for another day...
    • page templates
    • z3c.forms
    • deliverance
    • viewlets
    • theme development
    • supervisor
    • gloworm
    • cssmanager
    • content migration
    • etc., etc., etc...
  • 17. Q UESTIONS ?
    • Thanks!
    • Chris Crownhart
    • 303/809-1001
    • www.coresoftwaregroup.com
    • [email_address]