Python Tales and Plone Stories

4teamwork

OneGov Plone Theme

The package plonetheme.onegov contains a modern, generic, and responsive Plone theme we’ve been developing for the past 10 months. We are primarily using it for websites with additional OneGov modules installed. However, the theme is generic enough to work with standard Plone sites, too.

The OneGov theme is not just another Plone theme as it has some neat concepts. In this blog entry, I’d like to present the major technical features of this new theme.

Responsive Design for Mobile Devices

How to use responsive design for mobile devices?

By default, most webpages do not really work well on small displays (e.g. on smartphones). Usually, not all relevant information fits to the display – you are forced to scroll horizontally or zoom out which can become quite awkward. By using repsonsive design you can have your design dynamically adjust to the available screen width, giving you the best of your page, especially on mobile devices.

Setuptools Console_scripts Entrypoints and Buildout

If your Plone deployment story looks anything like ours, you probably have several Python packages that get pulled together by a project-specific buildout that lives in its own git repository.

While we try to keep those buildouts clean and pretty minimal, sometimes there’s need for little helper scripts that you want to execute from that buildout, but still should live in an appropriate package and therefore another repository.

Installing the Correct Plone Hotfixes

At 4teamwork we have dozens of different Plone sites running, old ones and new ones. Since we cannot migrate all the older sites to the latest version of Plone, we need to patch them, too. To further complicate the issue, for a site running e.g. Plone 3.0 more patches have to be applied than for a fresh install of Plone 4.3.

Git - Partially Applying a Patch

We are currently in the process of consolidating many of our packages for a large project into a single project.core package. We do this in order to simplify the dependency graph, testing, GitHub workflow and general maintenance. These are packages that we first decided should be optional, but now have grown to be such integral parts of the system that we have to have a hard dependency on them anyway.

ftw.tooltip Introduction - Add Tooltips to Your Plone Site

Plone has many great features, but sometimes it’s hard for a user to focus on the task at hand. Even more so if the user is not working with Plone all day.

To make the UI more expressive and to provide a better user experience, we built ftw.tooltip. It provides an easy way to add tooltips to your Plone site and works without customizing nor patching views, viewlets, forms, etc.

Construct Your Testing Data Using the Builder Pattern

Test data generation is always a hot topic when it comes to automated software testing. One of my first assignments at 4teamwork was to help with the testing. In the process I was browsing through the test suites of some big projects they are working on and noticed a lot of similar code related to data creation:

1
2
3
4
5
6
7
8
9
10
11
12
13
dossier = createContentInContainer(self.portal,
                                   'opengever.dossier',
                                   title='Dossier',
                                   checkConstraints=False)

test_file = NamedBlobFile("lorem ipsum", filename=u"test.txt")
document = createContentInContainer(dossier,
                                    'opengever.document',
                                    checkConstraints=False,
                                    title=u'Foobar',
                                    keywords=[],
                                    file=test_file)
transaction.commit()

This is very basic object creation code and I’m sure many Plone developers have written a fair amount of it. While this gets the job done, there is a lot of noise, that we don’t need to have in every test.

Our Blog About Plone and Python

This blog is about Plone, Python and related topics. It reflects the personal views and opinions of its different authors of 4teamwork. If you have questions or corrections to our articles, you are invited to get in touch with us!

4teamwork is a Plone software company based in Bern, Switzerland, consisting of a young and motivated team of 15 skilled developers and consultants.

We have been around in the Plone community for quite some time: Starting at the very early stage of Plone in 2002 and 2003, we have been witnessing its overwhelming growth and maturation during the past decade. On a side note, we had the privilege of organizing the very first Plone sprint in winter 2003 in Bern — as it turns out, the original website of this historic sprint is still available here. Since then, we have been designing, developing, and maintaining sophisticated web solutions in Plone for many governmental and non profit organizations, like zg.ch (canton of Zug, Switzerland), bern.ch (capital of Switzerland) or amnesty.ch (Amnesty International Switzerland). Furthermore, we help companies setting up their own intranet and/or extranet web service using Plone.

In the past few years, we have started to make our various developments publicly available. All these modules are actively maintained and continuously developed. Feel free to browse (and use) our numerous repositories on github.com/4teamwork. Any feedback (or pull requests ;) is welcome!

IMHO, Plone and Python are still going strong – let’s see what the future will hold!