Happy hacking with Plone

32
Happy hacking with Plone Éric Bréhault - PloneConf 2015

Transcript of Happy hacking with Plone

Page 1: Happy hacking with Plone

Happy hacking with PloneÉric Bréhault - PloneConf 2015

Page 2: Happy hacking with Plone

We, Plone developersinvest time in Plone,build something nice and attractive,feel pround of it.

Page 3: Happy hacking with Plone

We, Plone developers

from "Les Vacances du Petit Nicolas" by Laurent Tirard

.fx: extra-large

Page 4: Happy hacking with Plone

The users play

from "Les Vacances du Petit Nicolas" by Laurent Tirard

Page 5: Happy hacking with Plone

The conflictThey loved it.We are desperate.

Page 6: Happy hacking with Plone

We retaliate

Page 7: Happy hacking with Plone

Pharmakonφάρμακον: medecine, drug, poison

Any medecine is also a poison.

Page 8: Happy hacking with Plone

My solution

Page 9: Happy hacking with Plone

Hackability is a featureIt is not a flaw.

It must be provided as a tool.

Page 10: Happy hacking with Plone

A hacking tool...to change or add whatever we want in our Plone sitethrough a modern and pleasant web interface

... not a hackable system

Page 11: Happy hacking with Plone

ZMI?

Page 12: Happy hacking with Plone

The Plone Theming editor!Already a "hacking" tool:

non-Plone experts can change the entire theme.

Page 13: Happy hacking with Plone

Diazo theory"We Write XSLT, So You Don't Have To"

Page 14: Happy hacking with Plone

Diazo realityGuess what? I am writing tons of XSLT!!

Page 15: Happy hacking with Plone

What we need

Page 16: Happy hacking with Plone

Content-to-contentOn-the-fly content changes with <before/> and <after/>.

< b e f o r e c s s : c o n t e n t = " # c o n t e n t - c o r e " > < a h r e f = " m a i l t o : c o n t a c t @ d i a z o . o r g " > A s k f o r h e l p < / a >< / b e f o r e >

Page 17: Happy hacking with Plone

Content-to-contentOn-the-fly content insertion.

< b e f o r e c s s : c o n t e n t - c h i l d r e n = " # m a i n " > < i n c l u d e c s s : c o n t e n t = " # b r e a d c r u m b s " / >< / b e f o r e >

Page 18: Happy hacking with Plone

Content-to-contentOn-the-fly remote content insertion.

< b e f o r e c s s : c o n t e n t - c h i l d r e n = " # m a i n " > < i n c l u d e h r e f = " / n e w s " c s s : c o n t e n t = " # b r e a d c r u m b s " / >< / b e f o r e >

Page 19: Happy hacking with Plone

We want morecreate our own chuncks of contentimplement our own scripts

with basic knowledge of HTML and Python

Page 20: Happy hacking with Plone

Rapido

Page 21: Happy hacking with Plone

It lives in the themeEditable through the Plone interface......or in the sources.We use Diazo to inject it in Plone.

Page 22: Happy hacking with Plone

Dead simpleno ZCA stuff,no ZPT (or any templating language),no JBOT,

Just HTML and Python

Page 23: Happy hacking with Plone

Demo

Page 24: Happy hacking with Plone

What do we get in ourcontext?

context.app

context.request

context.portal

context.content

context.api (the Plone API!!)

Page 25: Happy hacking with Plone

Is it secure?Python scripts are executed byzope.security.untrustedpython.

All the regular security stack is applied, like:

current user privileges,CSRF policy (@PostOnly for instance).

Page 26: Happy hacking with Plone

Battery includedRapido comes with a complete REST API.

GET / POST / DELETE / PUT / PATCH

It is a ready-to-use JSON backend.

Page 27: Happy hacking with Plone

Demo

Page 28: Happy hacking with Plone

Battery includedRapido provides a Plone Content Rules action.

We can hook our scripts to any Plone event.

Page 29: Happy hacking with Plone

Battery includedRapido is Mosaic compliant.

(but it does not depend on it)

Page 30: Happy hacking with Plone

Demo

Page 31: Happy hacking with Plone

Thank you!

Page 32: Happy hacking with Plone