2012 ·English ·29 slides ·1656 views

Pragmatic plone projects

The document discusses best practices for completing pragmatic Plone projects based on lessons learned from a large Plone project for Weishaupt, a major heating systems company. It covers common customizations required in projects and recommends patching Python code and resources through forks, branches, and overrides rather than directly modifying third-party packages. The talk also provides tips for working within constraints of limited budgets, resources, and timeframes and keeping designers happy through sample content.

Slide 1 of 29 — Pragmatic plone projects
1/29 arrow keys or swipe · click image for fullscreen
Slide 1 of 29 — Pragmatic plone projects
1/29

Details

Uploaded
10 October 2012
Updated
1 December 2022
Language
English
Slides
29
Image size
2048x1536
Views
1656
SlideShare ID
14668236
Uploaded format
PDF, PPTX
Collected
2026-09-27

The description above is SlideShare's automatically generated summary, not the author's own text.

Source & completeness

Content
original + reconstructed
Validation
passed
Slide text
available (29 slides)
Original files
yes
  • original.pdf PDF · 1.0 MB · 29 slides
  • original.pptx PPTX · 3.8 MB · 29 slides
Checksums (SHA-256)
  • original.pdf: aad59c84190614921bd125c5c421e74897a93564ca956968db4492b8fa3a7604
  • original.pptx: 3bfa07e3e5e38a92807b21ff759a452eec201034892aae60f961d174706f3b87

Slide images come from SlideShare's public renderings (2048x1536 px, WebP). Any file marked as reconstructed is assembled from those images and is not the author's original source file.

Full text of every slide

Text extracted by SlideShare from the slide images — may contain OCR errors. 29 of 29 slides have text.

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
5
weishaupt.de
6
weishaupt.de
7
weishaupt.de
8
weishaupt.de
9
weishaupt.de
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
25
Auto-generated content
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.
29
Questions?