Skip to content. | Skip to navigation

Personal tools
Log in
Sections
You are here: Home

Latest Plone Posts

Docker experience with Plone

From Planet Plone. Published on Dec 18, 2014.

Turning a static theme into a Diazo theme through the web

By Chrissy Wainwright from Planet Plone. Published on Dec 18, 2014.

static to diazo Overview

  1. Find/Create a static theme
  2. Create a new Diazo theme in the Theming control panel
  3. Copy in files from theme
  4. Write/Build the rules.xml

Detailed Steps

  1. sample final themeFirst you’ll need a static theme. You can create one yourself, or find one on a free template site (make sure to read the terms of use!). The great thing is the theme doesn’t need to know anything specific about Plone, but you should still make sure all Plone elements that you want are displayed in the theme.

  2. Create a new Diazo theme

    • Go to Site Setup > Theming (or directly to @@theming-controlpanel)
    • Click the ‘New theme’ button. You will have the option to immediately enable the new theme. Note: I do not recommend this for a live site.
  3. You are taken to a theme editor where you can upload all files from your theme. Keep the folder structure the same. The only files you’ll need in addition to your static files are rules.xml and manifest.cfgmodify theme sample

  4. Write the rules. This is a single file that replaces the static content in your theme with dynamic content from Plone, based on the rules you define. The theme editor has tools built in to help you write the rules.

Show inspectors - This turns on a couple frames in the window, showing you both the static theme and unthemed Plone site. Hovering or clicking on the elements will give you a selector for that element.

inspector

Build rule - This is a wizard that writes rules for you based on settings you enter and elements you select. This is very helpful for learning Diazo syntax.

Build rule 1

build rule 2

Help - This displays the manual for plone.app.theming - the product that turns your Diazo theme into a Plone theme.

Once you have built all the rules, you can then Activate your theme in the Theming Control Panel to apply it to the entire site.


Like what you've read? Have a suggestion of something you'd like to see? Leave a comment below! You can see more trainings like this one at sixfeetup.com/plone-cms/plone-how-to. Also, be sure to sign up for our weekly Plone & Python How-To digests.

Using convolutional neural nets to detect facial keypoints tutorial

From Planet Plone. Published on Dec 17, 2014.

Using convolutional neural nets to detect facial keypoints tutorial

How to embed video on a page

By ledwell from Planet Plone. Published on Dec 16, 2014.

This is a work around for TinyMCE stripping out embed code. It uses the "Snippets" product created by Sam Schwartz.

Plone Conference Bucharest October 2015

From Planet Plone. Published on Dec 15, 2014.

Plone Conference 2015 will take place October 14-16, 2015, in Bucharest, Romania. The schedule will include pre-conference trainings and post-conference sprints.

zest.releaser and some add-ons

From Planet Plone. Published on Dec 15, 2014.

For some time we have been using a release_egg.sh script found in some plone svn repository (currently unreachable) to do proper egg releases, bump the egg version and upload them to pypi or our custom repository. But now we are moving to use zest.releaser for both public and private eggs. We have written two add-ons for it to ease our move from our previous hand-made-scripts.

Control setuptools version installed by buildout bootstrap

By Godefroid Chapelle from Planet Plone. Published on Dec 15, 2014.

use --setuptools-version as parameter when running bootstrap.py

Workaround setuptools 8.0 bug with zc.buildout

By Tom from Planet Plone. Published on Dec 12, 2014.

Buildout always fetches the latest version of setuptools for bootstraping. No matter what is defined in versions.cfg. It is possible to set the version of zc.buildout when bootstraping but not the one of setuptools.

This behavior is hardcoded in bootstrap.py.

77 ez = {}
78 exec(urlopen('https://bootstrap.pypa.io/ez_setup.py'
79             ).read(), ez)
80 if not options.allow_site_packages:

Unfortunately there are some incompatible changes (a bug?) in setuptools 8.0 which prevent zc.buildout from bootstraping. It fails with the following error:

tom@localhost:~/demobuildout> python2.7 bootstrap.py
Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-8.0.zip
Extracting in /tmp/tmp_34LbA
Now working in /tmp/tmp_34LbA/setuptools-8.0
Building a Setuptools egg in /tmp/tmpeA5PHB
/tmp/tmpeA5PHB/setuptools-8.0-py2.7.egg
Traceback (most recent call last):
  File "bootstrap.py", line 145, in <module>
    if _final_version(distv):
  File "bootstrap.py", line 131, in _final_version
    for part in parsed_version:
TypeError: 'Version' object is not iterable

I found a quite easy workaround to use a different version of setuptools until this issue is fixed. Setuptools 7.0 seems to work fine. Do the following:

  1. Create a directory and change to it:

    $ mkdir setuptools-workaround
    $ cd setuptools-workaround
    
  2. Download ez_setup.py:

    $ wget https://bootstrap.pypa.io/ez_setup.py
    
  3. Edit ez_setup.py and change the setuptools version to be used.:

    39 DEFAULT_VERSION = "7.0"
    40 DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
    
  4. Start a python webserver in the directory.:

    $ python -m SimpleHTTPServer
    

    The server does not daemonize itself. The following actions need to be done in a new terminal.

  5. Now change the line where it downloads ez_setup.py in your bootstrap.py file to use the patched ez_setup.py.:

    77 ez = {}
    78 exec(urlopen('http://localhost:8000/ez_setup.py'
    79             ).read(), ez)
    80 if not options.allow_site_packages:
    
  6. You are ready to start your working buildout.

    tom@linux-zoc2:~/demobuildout> python bootstrap.py
    Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.zip
    Extracting in /tmp/tmp82Jp3m
    Now working in /tmp/tmp82Jp3m/setuptools-7.0
    Building a Setuptools egg in /tmp/tmpgDuB3k
    /tmp/tmpgDuB3k/setuptools-7.0-py2.7.egg
    Generated script '/home/tom/demobuildout/bin/buildout'.
    

This works for me. Hope this bug is fixed soon anyway.

Naming things: don't use reserved words

By Reinout van Rees from Planet Plone. Published on Dec 12, 2014.

Update: added postfixed-with-underscore examples.

I'm currently cleaning up some code. Some people just cannot spell "p-e-p-8" if their lives depended on it, apparently. Luckily I'm civilized so I only threaten with dismemberment.

Look at this gem I just uncovered:

tg_after = instance.filter.technischegegevensfilter_set.exclude(
    pk=instance.pk).filter(
        datum_vanaf__gt=instance.datum_vanaf).order_by(
            'datum_vanaf')[:1]

Don't mind about the Dutch in there. Just look at those two filter words in the first two lines. They're even nicely underneath each other. At least they are now, I first had to fit the 159 characters long line within 78 characters, of course.

In Django, you do sql filtering with .filter(some_condition=42). That's not what's happening in the first line, though. There's a foreign key called filter there! So the first filter is the name of a foreign key and the second filter is the filter method that is used everywhere in Django.

Big confusion. And big chance that someone else that reads the code messes it up somehow.

So... steer clear of common words used in your programming language or framework or whatever. Some examples:

  • Don't use type as an name. Use customer_type or station_type or whatever. Only use type by itself if you really mean the python build-in. Alternatively you can postfix it with an underscore, so type_
  • Don't use class. Either use the often-used klass or class_ alternative if you want to keep it short. But why not use css_class if you want to return a css class, for instance?
  • Don't use filter for Django models. Even if you're modelling filters that are used for groundwater extraction (as in this case). Call them WaterFilter or so.

So... you can now go and fix your code. You've got about 45 minutes before I'm ready sharpening my axe.

Plone Foundation Board Elects Officers for 2014-2015

From Planet Plone. Published on Dec 11, 2014.

Meet your new Plone Foundation officers: Paul Roeland has been named President, Cris Ewing Vice-President, Steve McMahon Secretary and Jen Myers Treasurer.

A Review of the Web and how Morepath fits in

By Martijn Faassen from Planet Plone. Published on Dec 11, 2014.

I've spent a bit of time writing the somewhat grandiosely titled A Review of the Web, and I think it's a neat addition to the documentation of the Morepath web framework.

It attempts to do two things:

  • Help those developers who aren't as familiar yet with the details of web technology to get a handle on various concepts surrounding web frameworks and web services.
  • Show to developers who are more familiar with these concepts how Morepath fits in as a web framework.

Does this document fulfill either purpose? Let me know!

Plone community wisdom: a personal take on the Bristol Plone 2020 open space

By nguyen from Planet Plone. Published on Dec 11, 2014.

...wherein the author provides a personal reflection on an anxiety-causing possible crisis point for the Plone project, which was resolved brilliantly during the Plone 2020 open space

Stupid ZMI Tricks

By Rob McBroom from Planet Plone. Published on Dec 11, 2014.

Zope logoThe Zope Management Interface (ZMI) is the web interface for interacting with the Zope framework, which Plone runs on. As a new Plone developer, here are some of the things I've found useful within the ZMI.

When do you use the ZMI?

The short answer is "When you can't do something in site setup.", but there's more to it than that. For instance, it's a good place to look up the names and locations of things when writing code.

How do you access the ZMI?

To access the ZMI, you can simply add /manage to the end of any URL in Plone (though you’ll typically want to do it at the top of the site). Alternatively, you can go into Site Setup and select Zope Management Interface from the Plone Configuration section.

Tips

GenericSetup Changes

If you want to automate something using GenericSetup and aren't sure exactly what to create, or where, you can often find out this way:

portal snapshot screenshot

  1. Go to portal_setup and click the Snapshots tab.
  2. Create a snapshot.
  3. Make the desired changes using the Plone interface.
  4. Return to portal_setup and create another snapshot.
  5. While still in portal_setup, click the Comparison tab.
  6. Select the two snapshots and click Compare.

This will hopefully show the path to the XML files you need to create or modify in your policy package, as well as the changes you need to make there.

Explore the Catalog

Under the portal_catalog, the Catalog tab will allow you to explore containers and content objects in your site. This is a good way to discover what properties are available, or to confirm that something exists.

The Indexes tab is useful when you're attempting to create custom collections. You can browse the indexes to see if criteria are being assigned to objects as expected.

 

Exploring Types

The portal_types section is very helpful for learning about the built-in types, and probably even more useful when creating your own types in code.

portal types screenshot

Undoing Changes

In many areas of the ZMI, you'll see an "Undo" tab at the top of the page. This allows you to back out if a change ends up causing a problem. It also lets you see who made configuration changes and when.

ZMI Undo Tab

Repeating Import Steps

If you go to the "Import" tab under portal_setup, you'll be able to repeat some things that typically only happen when a package is loaded for the first time. Select a profile from the drop-down and you'll be presented with a list of available import steps.

Select the steps you want to repeat, or click "Import all steps" to go through the entire profile. This can be really handy when you're working on a new package and making frequent changes.

import tab screenshot

More Information

This article offers basic information and tips for the Zope Management Interface in Plone. For more detailed information and documentation visit http://docs.zope.org.


Was this article useful? Let us know in the comments and be sure to sign up for our Plone & Python How-To digests to receive more how-to guides as soon as they are published!

eGenix mxODBC Zope DA 2.2.0 GA

From Planet Plone. Published on Dec 11, 2014.

Introduction

The eGenix mxODBC Zope DA allows you to easily connect your Plone CMS or Zope installation to just about any database backend on the market today, giving you the reliability of the commercially supported eGenix product mxODBC and the flexibility of the ODBC standard as middle-tier architecture.

The mxODBC Zope Database Adapter is highly portable, just like Zope itself and provides a high performance interface to all your ODBC data sources, using a single well-supported interface on Windows, Linux, Mac OS X, FreeBSD and other platforms.

This makes it ideal for deployment in ZEO Clusters and Zope hosting environments where stability and high performance are a top priority, establishing an excellent basis and scalable solution for your Plone CMS.

>>>   mxODBC Zope DA Product Page

News

We are pleased to announce our new version 2.2.0 of the mxODBC Zope/Plone Database Adapter product.

In this release, we have upgraded the adapter to mxODBC 3.3.1 and added compatibility with the latest Plone releases and ODBC drivers/managers.

Feature Enhancements:

  • Compatible with Plone 4.0 - 4.3.
  • Compatible with the upcoming Plone 5.0.

Enhanced Support for Stored Procedures

  • Added documentation on how to call stored procedures from Plone / Zope.
  • Added support for input, output and input/output parameters to the .callproc() method for calling stored procedures.
  • Added documentation on how to use External Methods to access and use the mxODBC Zope DA connection objects.

Fast Cursor Types

  • Switched to forward-only cursor types for all database backends, since this provides a much better performance for MS SQL Server and IBM DB2 drivers.

Updated mxODBC API

Easier Installation

For the full list of features, please see the mxODBC Zope DA feature list.

Driver Compatibility Enhancements:

  • ODBC driver compatibility updated. By upgrading to the latest mxODBC 3.3 release, we are bringing all compatibility enhancements added to mxODBC 3.3 to the mxODBC Zope DA. This includes updated support for Oracle, MS SQL Server, Sybase ASE, IBM DB2, PostgreSQL and MySQL. See the mxODBC 3.3.0 and 3.3.1 release announcements for full details.
  • ODBC manager compatibility updated. Built against unixODBC 2.3.2, iODBC 3.52.8, DataDirect 7.1.2 on Unix. Built against the MS Windows Manager ODBC on Windows. Built against iODBC 3.52.8 on Mac OS X.

The complete list of changes is available on the mxODBC Zope DA changelog page.

Upgrading

Users are encouraged to upgrade to this latest mxODBC Plone/Zope Database Adapter release to benefit from the new features and updated ODBC driver support. We have taken special care not to introduce backwards incompatible changes, making the upgrade experience as smooth as possible.

For major and minor upgrade purchases, we will give out 20% discount coupons going from mxODBC Zope DA 1.x to 2.2 and 50% coupons for upgrades from mxODBC 2.x to 2.2. After upgrade, use of the original license from which you upgraded is no longer permitted. Patch level upgrades (e.g. 2.2.0 to 2.2.1) are always free of charge.

Please contact the eGenix.com Sales Team with your existing license serials for details for an upgrade discount coupon.

If you want to try the new release before purchase, you can request 30-day evaluation licenses by visiting our web-site or writing to sales@egenix.com, stating your name (or the name of the company) and the number of eval licenses that you need.

Downloads

Please visit the eGenix mxODBC Zope DA product page for downloads, instructions on installation and documentation of the packages.

If you want to try the package, please jump straight to the download instructions.

Fully functional evaluation licenses for the mxODBC Zope DA are available free of charge.

Support

Commercial support for this product is available directly from eGenix.com.

Please see the support section of our website for details.

More Information

For more information on eGenix mxODBC Zope DA, licensing and download instructions, please write to sales@egenix.com.

Enjoy !

Marc-Andre Lemburg, eGenix.com

Announcing the "XML-Director" XML CMS project

From Planet Plone. Published on Dec 09, 2014.

XML-Director will be a new-generation XML content management system based on the Plone 5 CMS with either eXist-db or Base-X as backend. Additional components will provide DOCX to XML and XML/HTML to PDF/EPub conversion, support for desktop and web-based XML editors.