What if you could use Plone only as a CMS and program a frontend in whichever Python web framework you want, with transparent access to the content? This way you get a proven, high-reward, low-maintenance CMS as a content backend and are free to write your application on top of that using the power and flexibility of your favorite web framework.
21. Configure the database with ZCML <configure xmlns="http://namespaces.zope.org/zope" xmlns:db="http://namespaces.objectrealms.net/rdb" xmlns:ore="http://namespaces.objectrealms.net/mirror"> <!-- setup a database connection --> <db:engine url="postgres://localhost/plone" name="mirror-db" echo="True"/> <!-- associate the database connection to mirror db structures --> <db:bind engine="mirror-db" metadata="ore.contentmirror.schema.metadata" /> </configure>
22. Configure custom content types For each custom content type installed on the site: <ore:mirror content= "Products.ATContentTypes.content.document.ATDocument" />
23. Generate tables and upload content dropdb plone createdb plone --encoding=UTF-8 # generate table definitions and create tables bin/instance run parts/productdistros/ContentMirror/ddl.py postgres > mirror.sql psql plone < /home/andy/plone/zinstance/mirror.sql # optionally, load existing content bin/instance run parts/productdistros/ContentMirror/bulk.py Plone
25. The changes are sent synchronously to the database plone# select content_id, id, title from content where id = 'front-page'; content_id | id | title ------------+------------+---------------- 8 | front-page | Content Mirror sent this (1 row)
28. Plango, by Andy McKay from django.db import models from django.contrib.contenttypes.models import ContentType from utils import normalize_name class Content(models.Model): class Meta: db_table = u'content' content_id = models.IntegerField(primary_key=True, editable=False) id = models.CharField(max_length=256, editable=False) uid = models.CharField(unique=True, max_length=36, editable=False) portal_type = models.CharField(max_length=64, editable=False) status = models.CharField(max_length=64, editable=False, null=False) type = models.CharField(max_length=64, editable=False) container = models.ForeignKey('self', related_name="parent", editable=False)
29.
30.
31. By the way, don't worry about the Component Architecture. We have studied the Zope CA so you don't have to.
32.
33. GAE front end application import os import wsgiref.handlers from google.appengine.ext import webapp from google.appengine.ext.webapp import template from google.appengine.ext import db from google.appengine.ext.db import polymodel from google.appengine.api import users class PloneContent(polymodel.PolyModel): id = db.StringProperty() uid = db.StringProperty() portal_type = db.StringProperty() status = db.StringProperty() type = db.StringProperty()