2. Who am I?
Dylan Jay
Core Plone Contributor
1995 First web app (ISAPI)
1999 Built first e-commerce
site (zope)
2003 Built first startup
(IntroVino)
2004 Started
PretaWeb/PretaGov (Plone0
3. Reasons for this talk
History
"Those who don't learn from history are
doomed to add it as a feature of their
framework"
Better choices
There is no perfect framework, only a perfect mess when you pick
wrong
Reuse
6. Zope - wtf was that about?
Back in 1996
● webserver = path to file
● cgi = path to script + args
● OO - was very big
● Jim Fulton was on a
plane
traversal = path to object + '/' + method
zope = zope object publishing environment
8. Traversal - why?
Good for CMS
plugins cooperating
webapps
complex apps
TraversalRoutes
/A/B/C/myaction/myaction/id123
distributedcentrally defined
Good for relational
single use apps
9. Goodie #2: ZODB
● Want to store something non relational?
● Want to store something non key-value?
● Got complex object structures?
Use Object persistence
13. Adapters: why?
● Solves how to plug complex software
together
● Better than Object Orientation
● Perfect for overridable software
● Perfect for plugin architecture
● ZTK - ZCA - Zope3 == Adapters
14. ZTK Adapters
class IUSPlug(zope.interface):
prongs = Attribute("""number of prongs""")
class Motox(object):
implements(IUSPlug)
prongs = 2
class INZPlug(zope.interface):
prongs = Attribute("""number of prongs""")
17. Goodie #4: Sprints
“The practice of using sprints for open source
software development was pioneered by the
Zope Corporation in the early days of the Zope
3 project. Between January 2002 and January
2006, more than 30 Zope 3 sprints had taken
place.[citation needed]”
Plone Pacific Rim Sprint 14-15 Sept
19. Pyramid: It's micro!
from wsgiref.simple_server import make_server
from pyramid.view import view_config
from pyramid.config import Configurator
if __name__ == '__main__':
config = Configurator()
config.add_route('hello', '/hello/{name}')
config.scan()
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
@view_config(route_name='hello', renderer='json')
def hello_world(request):
return {'content':'Hello %(name)s!' % request.matchdict}
20. Pyramid: worst name ever
Pyramid (the structure) Pyramid (the framework)
Start big - End small Start small - End big
Ancient Best of breed
Unchanging over time Extensible & Flexible
21. Pyramid: a "micro & more"
Framework
● a declarative authorization system
● extensibility: aggregate Pyramid application
configuration from multiple sources
● separate I18N translation string factories
● reuse: "Interface" based view/subscriber
registrations
● optionally map URLs to code using traversal
22. Pyramid: routes vs.
traversal: why not both?
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
class Resource(dict):
pass
def get_root(request):
return Resource({'a': Resource({'b': Resource({'c': Resource()})})})
def hello_world_of_resources(context, request):
output = "Here's a resource and its children: %s" % context
return Response(output)
if __name__ == '__main__':
config = Configurator(root_factory=get_root)
config.add_view(hello_world_of_resources, context=Resource)
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
24. Buildout
● uses recipes - python packages that know
how to build other things
○ like puppet
● automated dependencies
○ like Make
● recipes download and install python
packages into your environment
○ like PIP/easy_install
● everything gets installed into a local directory
isolated from your system
○ like virtualenv
25. Buildout is like...
you need it when
- you’re on tour (deploy different places)
- very different components
26. Goodie #7: Plone
300+ core contributors
400+ plugins
1000+ commits/month
5-8 sprints per year
1 Plone foundation
1-2 CVE's/year
27.
28. Plone
Plone step 1: Install
wget --no-check-certificate https://launchpad.
net/plone/4.3/4.3.1/+download/Plone-4.3.1-
UnifiedInstaller.tgz
# Extract the downloaded file
tar -xf Plone-4.3-UnifiedInstaller.tgz
# Go the folder containing installer script
cd Plone-4.3-UnifiedInstaller
# Run script
./install.sh standalone
cd ~/Plone/zinstance
bin/instance fg
32. Framework vs CMS
start with a blank page start with fully featured site
build up customise down
good for "app" sites good for "content" sites others can edit
Framework CMS
startup tool agency tool
risk reinventing the wheel risk hitting customisation cliff
dev has full control shared control, editors, admin, dev, themer
33. Content Editor Site Admin
Separation of concerns
Backend devFrontend dev /
Themer
Integrator
Reviewer
40. Goodie #8: Diazo
- Ultimate in code - html seperation
- templates without altering your html
- allows designer to work on html while you
work on the code - round trip
41. Diazo.org
1. app with very simple html
- "content"
2. create mockups in html of
how you want the pages to
really look - "theme"
3. create a rules.xml.
4. Compile it to single XSLT
file,
5. execute it in middleware