From mn/geo/geoit
Jump to: navigation, search


Plone is easy to install but a pain to customize, the latest version we are working with is Plone 4.1.

This page is primarily being used by JFB for keeping notes on the migration task from Plone 2.5 to Plone 4.1.

Jfb 10:58, 29 September 2011 (CEST)

Working Through Aspeli Book

Followed the main recipes provided for the example 'Optilux' site. The key things done so far include:

  1. Creating a custom theme from an example
  2. Creating a custom BrowserView (or is it a product, I'm not sure)
  3. Adding JavaScript to templates

Creating a custom theme

  1. copy over the example template them
  2. replace all instances of the previous them title or name
  3. run:
bin/zopeskel plone myproject.theme

Now, copy over all the components from the original theme into that directory:

-- configure.zcml --

Another Approach

Here's an approach that should work according to IRC folks:

See also:

Creating a BrowserView Product


Creating Custom Content

%bin/zopeskel plone optilux.cinemaconten

1) edit *generated* file:

    ' [grok]',
    'plone.namedfile [blobs]',

2) edit main packages.cfg add dexterity know good set:


    optilux.cinemacontent [test]

    optilux.cinemacontent = fs optilux.cinemacontent

3) edit buildout.cfg to assure optilux.cinemacontent is forced checked out (not in book)

4) edit optilux.policy and add optilux.cinemacontent as a dependency in

5) edit optilux.policy profiles/default/metadata.xml and set optilux.cinemacontent as a dependency

6) run bin/buildout

Adding javascript

There are some key pieces of information for this here: | community-developer-documentation


| client-side-functionality

Looking closely at:

| jquery

| javasscript

However, there are some key pieces of information missing. Most notably, any scripts requiring an 'onload' command need to include this piece of information at the top of the template:

<metal:javascriptslot fill-slot="javascript_head_slot">
          <script type="text/javascript" src="++resource++transport.fpi.static/DynamicOptionList.js"></script>
          <script type="text/javascript">

           <!-- inside here include 'onload' requirements -->
                  j$ = jQuery.noConflict();

Just some personal notekeeping:

  1. installed Plone using the Aspeli guidelines and a simple buildout.
  2. I Created (or used the optilux example) policy package that actually requires Plone. This seems to simplify things, so that it is not actually 'Plone' that I will install to the server, but my own bin/buildout policy package.
  3. I created a new theme for the transport site using the optilux template as an example. I need to go back above and flush out how this is accomplished exactly, but it mostly was done by copying the optilux.theme and replacing any instance of optilux with 'transport'. However, I also had to make some configuration changes in the confifgure.zcml, module, and module (maybe a few others too).
  4. created a new BrowserView product. This is going to replace the fpi cgi stuff I had before, or at least the front end. I imagine for now the CGI aspect may still be used, but we'll see. I guess the next step is figuring out how to render forms, etc. I will probably have to work with PloneFormGen.

Plotting Directly without Saving

Working out zope/plone and matplotlib

Working Case to return a image

In the view::

        if self.request.get('REQUEST_METHOD', 'GET').upper() == 'POST':
            """ process """
            from testmpl import make_fig
            im = make_fig()
            self.request.response.setHeader('Content-Type', 'image/png')

In the make_fig() function:

            imgdata = StringIO.StringIO()
            fig.savefig(imgdata, format='png')
    # rewind the data
            return imgdata

Following the overall scheme here:

With the exception that:

    fig = matplotlib.pyplot.figure()  

rather than this which did *not* work for me:

    from matplotlib.figure import Figure
    fig = Figure()