Plone For Developers - World Plone Day, 2009

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Plone For Developers - World Plone Day, 2009 - Presentation 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]

    + Core Software GroupCore Software Group, 2 months ago

    custom

    144 views, 0 favs, 0 embeds more stats

    Core Software Group and the Denver Plone Users Grou more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 144
      • 144 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 4
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories