Content Mirror and Pylons

Jan 12, 2009 04:35 PM
I was experimenting with Pylons and Content Mirror. The result, a proof of concept product called Plyne.
Following posts from Carlos De La Guardia and Kapil Thangavelu (aka hazmat) i started to play with ContentMirror. ContentMirror serializes content from a Plone site to a relational database. Once the Plone content is in a relational database, it is possible to write a small application to consume those data. The result, a lightweight  alternative for Plone deployment. In my case i wanted to use Pylons and i was surprised how easy was everything.

 

According documentation, Content Mirror supports MySql and Postgresql at least, but I'm too lazy to setup a relational database, so i started using sqlite. Anyway my laziness goes beyond that, I even wanted not to think how to do that and i found a document at eletztrick.de with the lines to setup ContentMirror and Sqlite. Cool!.

Following those very simple steps, i got Plone's content in a relational database. The generated tables are very intuitive. For example, in a Plone default's site you'll get something like:

table|content|content|3|CREATE TABLE content (
        content_id INTEGER NOT NULL,
        id VARCHAR(256) NOT NULL,
        uid VARCHAR(36) NOT NULL,
        portal_type VARCHAR(64),
        status VARCHAR(64),
        type VARCHAR(64),
        container_id INTEGER,
        title TEXT,
        description TEXT,
        subject TEXT,
        location TEXT,
        contributors TEXT,
        creators TEXT,
        creation_date TIMESTAMP,
        modification_date TIMESTAMP,
        effectivedate TIMESTAMP,
        expirationdate TIMESTAMP,
        language TEXT,
        rights TEXT,
        PRIMARY KEY (content_id),
         FOREIGN KEY(container_id) REFERENCES content (content_id)
)

.....

table|atdocument|atdocument|22|CREATE TABLE atdocument (
    content_id INTEGER NOT NULL, 
    text TEXT, 
    presentation BOOLEAN, 
    tablecontents BOOLEAN, 
    PRIMARY KEY (content_id), 
     FOREIGN KEY(content_id) REFERENCES content (content_id) ON DELETE CASCADE
)

 

Just to show two of them. The complete SQL is available here. That's a default Plone site, Content Mirror also supports custom archetypes but I haven't test that yet. Using those tables we dump the database. Here's available a dump for sqlite3.

Regarding the Pylons app... there's not much to say, but it is a proof of concept project, some lines aren't very nice but my idea was to test what is possible to do in a couple of hours and it works(tm). The result is available here. And you can watch it running here -this is a test url and it may not work in future-.

My goal is keep working with Plyne to cover at least two base cases, this blog and menttes' website.

Comments (0)