SlideShare a Scribd company logo
Pragmatic	
  Plone	
  Projects	
  

     Plone	
  Conference	
  2012	
  
               Arnhem	
  

               Andreas	
  Jung	
  	
  
                ZOPYX	
  Ltd.	
  
     www.zopyx.com,	
  info@zopyx.com	
  
Speaker	
  
•  long-­‐time	
  Python,	
  Zope,	
  	
  
   Plone	
  developer	
  	
  and	
  contributor	
  
•  Lead	
  developer	
  and	
  principal	
  consultant	
  of	
  	
  
   ZOPYX	
  Limited	
  
    –  Zope,	
  Python,	
  Pyramid,	
  Plone	
  projects	
  
    –  large	
  portals,	
  intranet,	
  internet,	
  extranet	
  
    –  Electronic	
  Publishing	
  
    –  complex	
  domain-­‐specific	
  applications	
  	
  
This	
  talk	
  is	
  about	
  
•  practical	
  hints	
  surviving	
  your	
  next	
  	
  
   Plone	
  project	
  
•  best	
  practices	
  
•  lessons	
  learned	
  from	
  our	
  last	
  	
  
   larger	
  Plone	
  project	
  
•  stuff	
  perhaps	
  covered	
  already	
  by	
  the	
  	
  
   Plone	
  trainings	
  
Relaunch	
  weishaupt.de	
  
•  Weishaupt:	
  	
  
    –  major	
  vendor	
  of	
  heating	
  systems	
  
    –  480	
  M€	
  revenue	
  
•  Large	
  company	
  portal	
  on	
  top	
  of	
  Plone	
  4.2	
  
•  Phase	
  1:	
  
    –  implementation	
  and	
  DE	
  content	
  
    –  4	
  months	
  
•  Phase	
  2:	
  
    –  20	
  subsidaries 	
  	
  
    –  more	
  than	
  30	
  languages	
  
weishaupt.de	
  
weishaupt.de	
  
weishaupt.de	
  
weishaupt.de	
  
weishaupt.de	
  
Project	
  constraints	
  (1/3)	
  

There	
  is	
  no	
  real-­‐world	
  project	
  with	
  

•  unlimited	
  budget	
  

•  unlimited	
  human	
  resources	
  

•  unlimited	
  time	
  
Project	
  constraints	
  (2/3)	
  

                 Resources	
  




    Budget	
                     Time	
  
Project	
  constraints	
  (3/3)	
  


Conclusions	
  

•  usually	
  impossible	
  finding	
  the	
  	
  
   „perfect“	
  solution	
  

•  the	
  	
  „perfect“	
  solution	
  is	
  	
  „mission	
  impossible“	
  
Getting	
  things	
  done	
  
•  within	
  a	
  reasonable	
  time-­‐frame	
  

•  on	
  budget	
  

•  with	
  the	
  available	
  human	
  resources	
  
Common	
  customizations	
  
•  Bugs	
  in	
  Plone	
  and	
  3rd-­‐party	
  packages	
  
   are	
  all	
  around	
  you	
  
•  Particular	
  behavior	
  of	
  Plone	
  or	
  3rd-­‐party	
  
   packages	
  is	
  a	
  common	
  project	
  requirement	
  
•  What	
  must	
  be	
  usually	
  customized:	
  
    –  Python	
  code	
  (browser	
  views,	
  skin	
  scripts)	
  
    –  Resources	
  (browser	
  view	
  templates,	
  JS,	
  CSS)	
  
Where	
  to	
  fix	
  things?	
  
•  Package	
  maintainer	
  (Plone	
  and	
  3rd-­‐party)	
  love	
  
      –  bug	
  reports	
  
      –  bug	
  fixes	
  
      –  contributions	
  
•  Stuff	
  on	
  Github:	
  Fork	
  &	
  Pull	
  request	
  
•  SVN	
  repositories:	
  svn	
  branch	
  &	
  svn	
  merge	
  
      –  check	
  if	
  the	
  package	
  is	
  maintained	
  
      –  ask	
  the	
  maintainer	
  for	
  merging	
  your	
  changes	
  or	
  merge	
  yourself	
  
      –  move	
  packages	
  to	
  Github	
  if	
  appropriate	
  
Where	
  and	
  how	
  to	
  	
  
                     customize	
  things?	
  
•  Is	
  your	
  required	
  change	
  of	
  interest	
  for	
  the	
  public?	
  
    –  fork	
  on	
  Github	
  
    –  branch	
  in	
  SVN	
  
    –  speak	
  with	
  the	
  package	
  maintainers	
  

•  Your	
  change	
  satisfies	
  an	
  absurd	
  customer	
  
   request?	
  
    –  keep	
  it	
  for	
  yourself.	
  
(Monkey)	
  Patching	
  Python	
  code	
  
 •  Monkey	
  patching:	
  	
  
    „dynamic	
  modifications	
  of	
  a	
  class	
  or	
  module	
  at	
  runtime“	
  
    (Source:	
  Wikipedia)	
  

 •  MP	
  in	
  general	
  should	
  be	
  considered	
  evil	
  and	
  bad-­‐style	
  
 •  MP	
  may	
  have	
  side-­‐effects	
  
 •  Use	
  MP	
  carefully	
  (and	
  only	
  when	
  you	
  know	
  what	
  you	
  are	
  
    doing)	
  
Monkey	
  patching	
  in	
  Python	
  
      Original	
  (foo.py)	
             Patched	
  version	
  (my_foo.py)	
  
class Foo:!                      def my_bar(self):!
!                                    return 43!
    def bar(self):!              !
           return 42!            from foo import Foo!
                                 Foo.bar = my_bar!
                                 !
                                 # or (needed in some situations)!
                                 !
                                 Foo.bar.func_code = my_bar.func_code!
Monkey	
  patching	
  Plone	
  
                                   collective.monkeypatcher	
  (patches.zcml)	
  
ZCML-­‐level	
  configuration	
  of	
  patching	
     <configure...>!
                                                         <include package="collective.monkeypatcher" />!
information:	
                                           <monkey:patch!
•  module-­‐level	
  patches	
                               description="ISE-42: OFS.Image.tag()"!
•  class-­‐level	
  patches	
                                class="Products.CMFCore.FSImage.FSImage"!
                                                             original="tag"!
                                                             replacement=".patches.tag"!
                                                             />!
                                                     </configure>!




                          collective.monkeypatcherpanel	
  (patches.zcml)	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
Patching	
  resources	
  (1/2)	
  –	
  
                     overrides.zcml	
  
     •  Standard	
  mechanism	
  for	
  overriding	
  configuration	
  
        settings	
  introduced	
  through	
  a	
  different	
  package	
  
     •  overrides.zcml	
  is	
  an	
  optional	
  ZCML	
  configuration	
  file	
  
    Products.PloneGlossary	
  (configure.zcml)	
             my.package	
  (overrides.zcml)	
  
<configure..> !                                     <configure..> !
  <browser:page!                                      <browser:page!
       name="glossary_main_page“         !                 name="glossary_main_page"!
    for="Products.PloneGlossary.IPloneGlossary"!        for="Products.PloneGlossary.IPloneGlossary"!
       class=".pages.GlossaryMainPage"!                    class=".glossary.GlossaryView“!
       permission="zope2.View“ />!                         permission="zope2.View“ />!
</configure>!                                       </configure>!
                                                    !
Patching	
  resources	
  (2/2)	
  –	
  z3c.jbot	
  

•  z3c.jbot	
  allows	
  you	
  to	
  override	
  resources	
  of	
  other	
  
     packages	
  inside	
  your	
  own	
  policy	
  package	
  
•  Limited	
  to	
  .pt,	
  .cpt,	
  .js?!	
  
Configuration:	
  <browser:jbot	
  	
  directory=“overrides“	
  />	
  

Existing	
  template:	
  plone.app.search/plone/app/search/search.pt	
  

Customization:	
  your.package/your/package/overrides/plone.app.search.search.pt	
  

Links	
  
•    http://blog.keul.it/2011/06/z3cjbot-­‐magical-­‐with-­‐your-­‐skins.html	
  
•    http://pypi.python.org/pypi/z3c.jbot	
  
Unconfigure	
  	
  
                resource	
  configurations	
  
   •  Sometimes	
  you	
  just	
  don‘t	
  want	
  or	
  need	
  ZCML	
  
      configurations	
  introduced	
  by	
  other	
  packages	
  
   •  z3c.unconfigure	
  is	
  your	
  friend	
  
        some.package(configure.zcml)	
                    my.package	
  (configure.zcml)	
  
<configure..> !                                   <configure..> !
  <browser:page!                                    <include package="z3c.unconfigure"     !
       name="glossary_main_page“          !                  file="meta.zcml" />!
   for="Products.PloneGlossary.IPloneGlossary"!     <unconfigure>!
       class=".pages.GlossaryMainPage"!               <browser:page!
       permission="zope2.View“ />!                         name="glossary_main_page“   !
</configure>!                                        for="Products.PloneGlossary.IPloneGlossary"!
                                                           class=".glossary.GlossaryView“!
                                                           permission="zope2.View“ />!
                                                    </unconfigure>!
                                                  </configure>!
                                                  	
  
Extending	
  schemas	
  
Plone	
  comes	
  with	
  two	
  content-­‐type	
  systems	
  
•  Archetypes	
  (old-­‐style)	
  
     –  use	
  archetypes.schemaextender	
  
     –  modify	
  any	
  AT-­‐based	
  content-­‐type	
  
         (modifying	
  fields,	
  adding	
  fields)	
  
     –  SchemaExtender,	
  SchemaModifier	
  
•  Dexterity	
  (new-­‐style)	
  
     –  Dexterity	
  introduces	
  „behaviors“	
  
     –  „A	
  behavior	
  is	
  a	
  re-­‐usable	
  aspect	
  of	
  an	
  object	
  that	
  can	
  be	
  enabled	
  or	
  
         disabled	
  without	
  changing	
  the	
  component	
  registry“	
  	
  
         (Source:	
  Dexterity	
  developer	
  manual)	
  
Keep	
  your	
  designer	
  happy	
  

   Implementing	
  CSS	
  styles	
  	
  
requires	
  representative	
  content	
  



  http://localhost:8080/@@new-site?content=1!
Auto-­‐generated	
  content	
  
Predefined	
  sample	
  content	
  
•  Write	
  a	
  browser	
  view	
  
    –  creating	
  a	
  Plone	
  site	
  with	
  policy	
  package	
  +	
  add-­‐ons	
  
    –  installing	
  the	
  basic	
  site-­‐structure	
  
    –  creating	
  example	
  content	
  for	
  each	
  content-­‐type,	
  content-­‐
       listing	
  etc	
  

•  use	
  http://lorempixel.com/600/400	
  ...	
  
•  look	
  at	
  loremipsum,	
  collective.loremipsum	
  or	
  
   zopyx.ipsumplone	
  
Predefined	
  sample	
  content	
  
•  Throw	
  your	
  sandbox/Plone	
  working	
  site	
  away	
  	
  
   as	
  often	
  as	
  possible	
  
•  sometimes	
  I	
  created	
  30-­‐40	
  new	
  Plone	
  sites	
  per	
  day	
  
•  Pragmatic	
  side-­‐effect	
  
    –  the	
  content	
  fixture	
  code	
  can	
  be	
  used	
  as	
  unit	
  test	
  where	
  all	
  
        your	
  content-­‐types	
  and	
  site-­‐infrastructure	
  is	
  created	
  and	
  
        tested	
  in	
  one	
  run	
  
    –  not	
  the	
  best	
  solution	
  but	
  it	
  works	
  reasonably	
  well	
  
Some	
  good	
  hints	
  
•  Never	
  ever	
  perform	
  customizations	
  in-­‐place	
  in	
  
   existing	
  3rd-­‐party	
  packages.	
  NEVER!!!	
  	
  
•  Customizations	
  always	
  belong	
  into	
  your	
  own	
  
   policy	
  package.	
  
•  Local	
  customizations	
  of	
  3rd-­‐party	
  package	
  will	
  
   be	
  lost	
  with	
  the	
  next	
  version	
  of	
  customized	
  
   package.	
  
Questions?	
  

More Related Content

PPTX
Pragmatische Plone Projekte
PPTX
Pragmatic plone projects
PPTX
Python mongo db-training-europython-2011
PDF
PyFilesystem
PPT
DSpace UI Prototype Challenge: Spring Boot + Thymeleaf
PPTX
Professional Help for PowerShell Modules
PDF
Puppi. Puppet strings to the shell
PPTX
PHP language presentation
Pragmatische Plone Projekte
Pragmatic plone projects
Python mongo db-training-europython-2011
PyFilesystem
DSpace UI Prototype Challenge: Spring Boot + Thymeleaf
Professional Help for PowerShell Modules
Puppi. Puppet strings to the shell
PHP language presentation

What's hot (20)

ODP
Getting started with Django 1.8
PDF
Puppet @ Seat
PPTX
Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)
PDF
Anatomy of a reusable module
ODP
Dexterity in 15 minutes or less
PDF
On the Edge Systems Administration with Golang
PPTX
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
PPTX
PyGrunn 2017 - Django Performance Unchained - slides
PDF
Can you upgrade to Puppet 4.x?
PDF
Puppet modules: A Holistic Approach - Geneva
PDF
Puppet: From 0 to 100 in 30 minutes
PPTX
PowerShell - Be A Cool Blue Kid
PDF
Go for SysAdmins - LISA 2015
PPSX
Sunil phani's take on windows powershell
PDF
Tornadoweb
PDF
Puppet modules for Fun and Profit
PDF
Doing It Wrong with Puppet -
PPTX
Get Django, Get Hired - An opinionated guide to getting the best job, for the...
PDF
Hdfs java api
PDF
Php on Windows
Getting started with Django 1.8
Puppet @ Seat
Puppet Virtual Bolt Workshop - 23 April 2020 (Singapore)
Anatomy of a reusable module
Dexterity in 15 minutes or less
On the Edge Systems Administration with Golang
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
PyGrunn 2017 - Django Performance Unchained - slides
Can you upgrade to Puppet 4.x?
Puppet modules: A Holistic Approach - Geneva
Puppet: From 0 to 100 in 30 minutes
PowerShell - Be A Cool Blue Kid
Go for SysAdmins - LISA 2015
Sunil phani's take on windows powershell
Tornadoweb
Puppet modules for Fun and Profit
Doing It Wrong with Puppet -
Get Django, Get Hired - An opinionated guide to getting the best job, for the...
Hdfs java api
Php on Windows
Ad

Viewers also liked (20)

PDF
Frequently asked questions answered frequently - but now for the last time
PDF
State Of Zope Linuxtag 2008
PDF
Integration of Plone with eXist-db
PDF
Onkopedia - Ein medizinisches Leitlinienportal auf dem Weg zu XML-basierten P...
PDF
XML Director - the technical foundation of onkopedia.com
PDF
BRAINREPUBLIC - Powered by no-SQL
PDF
Producing high-quality documents with Plone
PDF
Plone Integration with eXist-db - Structured Content rocks
PDF
Plone4Universities
PDF
Making Py Pi Sux Less Key
PPTX
Produce & Publish Authoring Environment V 2.0 (english version)
PDF
Produce & Publish Authoring Environment World Plone Day 2010 - Berlin
PDF
Building bridges - Plone Conference 2015 Bucharest
PDF
CSS Paged Media - A review of tools and techniques
PDF
Why Plone Will Die
PDF
Why we love ArangoDB. The hunt for the right NosQL Database
PDF
Konfigurationsgesteuerte Buildouts Dzug 2008
PPTX
Onkopedia - ein medizinisches Fachportal auf Basis von Plone
PPTX
zopyx.plone migration - Plone Hochschultagung 2013
PPTX
Produce & Publish Cloud Edition
Frequently asked questions answered frequently - but now for the last time
State Of Zope Linuxtag 2008
Integration of Plone with eXist-db
Onkopedia - Ein medizinisches Leitlinienportal auf dem Weg zu XML-basierten P...
XML Director - the technical foundation of onkopedia.com
BRAINREPUBLIC - Powered by no-SQL
Producing high-quality documents with Plone
Plone Integration with eXist-db - Structured Content rocks
Plone4Universities
Making Py Pi Sux Less Key
Produce & Publish Authoring Environment V 2.0 (english version)
Produce & Publish Authoring Environment World Plone Day 2010 - Berlin
Building bridges - Plone Conference 2015 Bucharest
CSS Paged Media - A review of tools and techniques
Why Plone Will Die
Why we love ArangoDB. The hunt for the right NosQL Database
Konfigurationsgesteuerte Buildouts Dzug 2008
Onkopedia - ein medizinisches Fachportal auf Basis von Plone
zopyx.plone migration - Plone Hochschultagung 2013
Produce & Publish Cloud Edition
Ad

Similar to Pragmatic plone projects (20)

PDF
Strategies for Puppet code upgrade and refactoring
PDF
Apache Maven - eXo TN presentation
PDF
Lorraine JUG (1st June, 2010) - Maven
PDF
Unleashing Creative Freedom with MODX (2015-07-21 @ PHP FRL)
PDF
Advanced Topics in Continuous Deployment
PDF
Drupal Front End PHP
PPT
Maven: Managing Software Projects for Repeatable Results
PDF
Building Content Types with Dexterity
PDF
"I have a framework idea" - Repeat less, share more.
PDF
IzPack at LyonJUG'11
PDF
Wait, IPython can do that?! (30 minutes)
PDF
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
PDF
Learning PHP for Drupal Theming, DC Chicago 2009
PDF
Django dev-env-my-way
KEY
Html5 Brown Bag
PDF
Netflix Nebula - Gradle Summit 2014
PPTX
Joomla plugin & module develpment - Presented at Sydney JUG 09/04/2013
PDF
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PDF
Using Vagrant, Puppet, Testing & Hadoop
PDF
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
Strategies for Puppet code upgrade and refactoring
Apache Maven - eXo TN presentation
Lorraine JUG (1st June, 2010) - Maven
Unleashing Creative Freedom with MODX (2015-07-21 @ PHP FRL)
Advanced Topics in Continuous Deployment
Drupal Front End PHP
Maven: Managing Software Projects for Repeatable Results
Building Content Types with Dexterity
"I have a framework idea" - Repeat less, share more.
IzPack at LyonJUG'11
Wait, IPython can do that?! (30 minutes)
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Learning PHP for Drupal Theming, DC Chicago 2009
Django dev-env-my-way
Html5 Brown Bag
Netflix Nebula - Gradle Summit 2014
Joomla plugin & module develpment - Presented at Sydney JUG 09/04/2013
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop

More from Andreas Jung (18)

PDF
A fool with a tool is still a fool - Plone Tagung 2025 in Koblenz
PDF
zopyx-fastapi-auth - authentication and authorization for FastAPI
PDF
State of PrintCSS - MarkupUK 2023.pdf
PDF
Typesense Plone Integration Plone Conference 2022 Namur
PDF
Onkopedia - Plone Tagung 2020 Dresden
PDF
PrintCSS W3C workshop at XMLPrague 2020
PDF
PrintCSS workshop XMLPrague 2020
PDF
Plone 5.2 migration at University Ghent, Belgium
PDF
Back to the future - Plone 5.2 und Python 3 Migration am Beispiel Onkopedia
PDF
Plone migrations using plone.restapi
PDF
Plone Migrationen mit Plone REST API
PDF
Plone im Einsatz bei der Universität des Saarländes als Shop-System und Gefah...
PDF
Generierung von PDF aus XML/HTML mit PrintCSS
PDF
Creating Content Together - Plone Integration with SMASHDOCs
PPTX
Creating Content Together - Plone Integration with SMASHDOCs
PDF
The Plone and The Blockchain
PDF
Content Gemeinsam Erstellen: Integration Plone mit SMASHDOCs
PDF
PDF Generierung mit XML/HTML und CSS - was die Tools können und was nicht.
A fool with a tool is still a fool - Plone Tagung 2025 in Koblenz
zopyx-fastapi-auth - authentication and authorization for FastAPI
State of PrintCSS - MarkupUK 2023.pdf
Typesense Plone Integration Plone Conference 2022 Namur
Onkopedia - Plone Tagung 2020 Dresden
PrintCSS W3C workshop at XMLPrague 2020
PrintCSS workshop XMLPrague 2020
Plone 5.2 migration at University Ghent, Belgium
Back to the future - Plone 5.2 und Python 3 Migration am Beispiel Onkopedia
Plone migrations using plone.restapi
Plone Migrationen mit Plone REST API
Plone im Einsatz bei der Universität des Saarländes als Shop-System und Gefah...
Generierung von PDF aus XML/HTML mit PrintCSS
Creating Content Together - Plone Integration with SMASHDOCs
Creating Content Together - Plone Integration with SMASHDOCs
The Plone and The Blockchain
Content Gemeinsam Erstellen: Integration Plone mit SMASHDOCs
PDF Generierung mit XML/HTML und CSS - was die Tools können und was nicht.

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Approach and Philosophy of On baking technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
cuic standard and advanced reporting.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Network Security Unit 5.pdf for BCA BBA.
Approach and Philosophy of On baking technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MYSQL Presentation for SQL database connectivity
Spectral efficient network and resource selection model in 5G networks
Advanced methodologies resolving dimensionality complications for autism neur...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
NewMind AI Weekly Chronicles - August'25 Week I
Chapter 3 Spatial Domain Image Processing.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
cuic standard and advanced reporting.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Dropbox Q2 2025 Financial Results & Investor Presentation
Digital-Transformation-Roadmap-for-Companies.pptx
The AUB Centre for AI in Media Proposal.docx

Pragmatic plone projects

  • 1. Pragmatic  Plone  Projects   Plone  Conference  2012   Arnhem   Andreas  Jung     ZOPYX  Ltd.   www.zopyx.com,  info@zopyx.com  
  • 2. Speaker   •  long-­‐time  Python,  Zope,     Plone  developer    and  contributor   •  Lead  developer  and  principal  consultant  of     ZOPYX  Limited   –  Zope,  Python,  Pyramid,  Plone  projects   –  large  portals,  intranet,  internet,  extranet   –  Electronic  Publishing   –  complex  domain-­‐specific  applications    
  • 3. This  talk  is  about   •  practical  hints  surviving  your  next     Plone  project   •  best  practices   •  lessons  learned  from  our  last     larger  Plone  project   •  stuff  perhaps  covered  already  by  the     Plone  trainings  
  • 4. Relaunch  weishaupt.de   •  Weishaupt:     –  major  vendor  of  heating  systems   –  480  M€  revenue   •  Large  company  portal  on  top  of  Plone  4.2   •  Phase  1:   –  implementation  and  DE  content   –  4  months   •  Phase  2:   –  20  subsidaries     –  more  than  30  languages  
  • 10. Project  constraints  (1/3)   There  is  no  real-­‐world  project  with   •  unlimited  budget   •  unlimited  human  resources   •  unlimited  time  
  • 11. Project  constraints  (2/3)   Resources   Budget   Time  
  • 12. Project  constraints  (3/3)   Conclusions   •  usually  impossible  finding  the     „perfect“  solution   •  the    „perfect“  solution  is    „mission  impossible“  
  • 13. Getting  things  done   •  within  a  reasonable  time-­‐frame   •  on  budget   •  with  the  available  human  resources  
  • 14. Common  customizations   •  Bugs  in  Plone  and  3rd-­‐party  packages   are  all  around  you   •  Particular  behavior  of  Plone  or  3rd-­‐party   packages  is  a  common  project  requirement   •  What  must  be  usually  customized:   –  Python  code  (browser  views,  skin  scripts)   –  Resources  (browser  view  templates,  JS,  CSS)  
  • 15. Where  to  fix  things?   •  Package  maintainer  (Plone  and  3rd-­‐party)  love   –  bug  reports   –  bug  fixes   –  contributions   •  Stuff  on  Github:  Fork  &  Pull  request   •  SVN  repositories:  svn  branch  &  svn  merge   –  check  if  the  package  is  maintained   –  ask  the  maintainer  for  merging  your  changes  or  merge  yourself   –  move  packages  to  Github  if  appropriate  
  • 16. Where  and  how  to     customize  things?   •  Is  your  required  change  of  interest  for  the  public?   –  fork  on  Github   –  branch  in  SVN   –  speak  with  the  package  maintainers   •  Your  change  satisfies  an  absurd  customer   request?   –  keep  it  for  yourself.  
  • 17. (Monkey)  Patching  Python  code   •  Monkey  patching:     „dynamic  modifications  of  a  class  or  module  at  runtime“   (Source:  Wikipedia)   •  MP  in  general  should  be  considered  evil  and  bad-­‐style   •  MP  may  have  side-­‐effects   •  Use  MP  carefully  (and  only  when  you  know  what  you  are   doing)  
  • 18. Monkey  patching  in  Python   Original  (foo.py)   Patched  version  (my_foo.py)   class Foo:! def my_bar(self):! ! return 43! def bar(self):! ! return 42! from foo import Foo! Foo.bar = my_bar! ! # or (needed in some situations)! ! Foo.bar.func_code = my_bar.func_code!
  • 19. Monkey  patching  Plone   collective.monkeypatcher  (patches.zcml)   ZCML-­‐level  configuration  of  patching   <configure...>! <include package="collective.monkeypatcher" />! information:   <monkey:patch! •  module-­‐level  patches   description="ISE-42: OFS.Image.tag()"! •  class-­‐level  patches   class="Products.CMFCore.FSImage.FSImage"! original="tag"! replacement=".patches.tag"! />! </configure>! collective.monkeypatcherpanel  (patches.zcml)                
  • 20. Patching  resources  (1/2)  –   overrides.zcml   •  Standard  mechanism  for  overriding  configuration   settings  introduced  through  a  different  package   •  overrides.zcml  is  an  optional  ZCML  configuration  file   Products.PloneGlossary  (configure.zcml)   my.package  (overrides.zcml)   <configure..> ! <configure..> ! <browser:page! <browser:page! name="glossary_main_page“ ! name="glossary_main_page"! for="Products.PloneGlossary.IPloneGlossary"! for="Products.PloneGlossary.IPloneGlossary"! class=".pages.GlossaryMainPage"! class=".glossary.GlossaryView“! permission="zope2.View“ />! permission="zope2.View“ />! </configure>! </configure>! !
  • 21. Patching  resources  (2/2)  –  z3c.jbot   •  z3c.jbot  allows  you  to  override  resources  of  other   packages  inside  your  own  policy  package   •  Limited  to  .pt,  .cpt,  .js?!   Configuration:  <browser:jbot    directory=“overrides“  />   Existing  template:  plone.app.search/plone/app/search/search.pt   Customization:  your.package/your/package/overrides/plone.app.search.search.pt   Links   •  http://blog.keul.it/2011/06/z3cjbot-­‐magical-­‐with-­‐your-­‐skins.html   •  http://pypi.python.org/pypi/z3c.jbot  
  • 22. Unconfigure     resource  configurations   •  Sometimes  you  just  don‘t  want  or  need  ZCML   configurations  introduced  by  other  packages   •  z3c.unconfigure  is  your  friend   some.package(configure.zcml)   my.package  (configure.zcml)   <configure..> ! <configure..> ! <browser:page! <include package="z3c.unconfigure" ! name="glossary_main_page“ ! file="meta.zcml" />! for="Products.PloneGlossary.IPloneGlossary"! <unconfigure>! class=".pages.GlossaryMainPage"! <browser:page! permission="zope2.View“ />! name="glossary_main_page“ ! </configure>! for="Products.PloneGlossary.IPloneGlossary"! class=".glossary.GlossaryView“! permission="zope2.View“ />! </unconfigure>! </configure>!  
  • 23. Extending  schemas   Plone  comes  with  two  content-­‐type  systems   •  Archetypes  (old-­‐style)   –  use  archetypes.schemaextender   –  modify  any  AT-­‐based  content-­‐type   (modifying  fields,  adding  fields)   –  SchemaExtender,  SchemaModifier   •  Dexterity  (new-­‐style)   –  Dexterity  introduces  „behaviors“   –  „A  behavior  is  a  re-­‐usable  aspect  of  an  object  that  can  be  enabled  or   disabled  without  changing  the  component  registry“     (Source:  Dexterity  developer  manual)  
  • 24. Keep  your  designer  happy   Implementing  CSS  styles     requires  representative  content   http://localhost:8080/@@new-site?content=1!
  • 26. Predefined  sample  content   •  Write  a  browser  view   –  creating  a  Plone  site  with  policy  package  +  add-­‐ons   –  installing  the  basic  site-­‐structure   –  creating  example  content  for  each  content-­‐type,  content-­‐ listing  etc   •  use  http://lorempixel.com/600/400  ...   •  look  at  loremipsum,  collective.loremipsum  or   zopyx.ipsumplone  
  • 27. Predefined  sample  content   •  Throw  your  sandbox/Plone  working  site  away     as  often  as  possible   •  sometimes  I  created  30-­‐40  new  Plone  sites  per  day   •  Pragmatic  side-­‐effect   –  the  content  fixture  code  can  be  used  as  unit  test  where  all   your  content-­‐types  and  site-­‐infrastructure  is  created  and   tested  in  one  run   –  not  the  best  solution  but  it  works  reasonably  well  
  • 28. Some  good  hints   •  Never  ever  perform  customizations  in-­‐place  in   existing  3rd-­‐party  packages.  NEVER!!!     •  Customizations  always  belong  into  your  own   policy  package.   •  Local  customizations  of  3rd-­‐party  package  will   be  lost  with  the  next  version  of  customized   package.