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>
Configure custom content types For each custom content type installed on the site: <ore:mirror content= "Products.ATContentTypes.content.document.ATDocument" />
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
That's it. We're ready to rock & roll
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)
What kind of sites can take advantage of this strategy?
Sites with a small number of content managers and a large number of users.
Which can clearly separate content management and presentation.
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)
Anyone?
Turbogears
Pylons
Werkzeug
Anything goes!
Content Mirror is easily extended
How about?
Reporting against the content
Audits of changes
Export to formats like JSON
Other storage backends
Content mirror Uses the Zope Component Architecture
We can easily plug in something other than a relational database
By the way, don't worry about the Component Architecture. We have studied the Zope CA so you don't have to.
A Google App Engine frontend
Take advantage of Google's infrastructure
Use their user authentication facilities
Let them worry about scaling
Of course, kinds of sites are limited, due to GAE's strict quotas
More like a toy, but shows what can be possible using Content Mirror with Plone
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()
Plone content in GAE
All discussed front ends will be made available during the sprints. Keep an eye on: http://contentmirror.googlecode.com/
Case study The Library of Congress in Chile
Create multiple sites in one instance
Select content from a shared store
Define a unique site layout and style
Deploy sites using repoze.bfg
Let Plone be a part of the Python universe
Thank you! Carlos de la Guardia email: [email_address] twitter: cguardia blog: http://blog.delaguardia.com.mx
What if you could use Plone only as a CMS and progr more
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. less
0 comments
Post a comment