Examining themes with Omelette and Python

3 min read

Installing themes with Buildout

For a lot of website projects, a theme downloaded from plone.org (http://plone.org/products) or the Python Package Index (http://pypi.python.org) is enough to launch a professional-looking site. If your project falls into this category, or if you just want to experiment, follow the steps in this chapter.

Searching for themes on plone.org

We will need to find a theme we like. We can do that by browsing to http://plone.org. Next, click on Downloads Add-on Product Releases | Themes|.

You should see (result similar to):

Click on a theme to view a screenshot and select one you like, for example beyondskins.ploneday.site2010, and add the package to your buildout.cfg file.

Adding themes with Buildout

In 03-appearance-wpd2010.cfg, we extend the last known working configuration file from Chapter 2, that is 02-site-basics-blog.cfg.

It looks like this:

[buildout]
extends = 02-site-basics-blog.cfg

[instance]
eggs += beyondskins.ploneday.site2010
zcml += beyondskins.ploneday.site2010

In addition to adding the package name to the eggs parameter, we must add it to the zcml parameter as well.

Now stop Plone (with Ctrl + C or Ctrl +Z/Enter) and run:

$ bin/buildout -c 03-appearance.cfg

Updating zope2.

Updating fake eggs

Updating instance.

Getting distribution for 'beyondskins.ploneday.site2010'.

Got beyondskins.ploneday.site2010 1.0.3.

Now start Plone:

$ bin/instance fg

Installing themes in Plone

Browse to http://localhost:8080/Plone. Now, click on Site Setup Add/Remove Products| and you should see:

Check the box next to WorldPloneDay: Theme for 2010 edition 1.0.3 and click on Install.

Now browse to http://localhost:8080/Plone and you should see:

This theme is the courtesy of Simples Consultoria (http://www.simplesconsultoria.com.br/). Thank you!

You can examine the anonymous view (what everyone else sees) by loading http://127.0.0.1:8080/Plone in your browser (that is. by using the IP address instead of the hostname). You can also load either of these URLs (http://127.0.0.1:8080/Plone or http://localhost:8080/Plone) from another web browser (besides the one you are currently using) to see the anonymous view (for example, Safari or Internet Explorer, instead of Firefox).

To display the blog entry to the public, we have transitioned the other objects in the site root to the private state.

Examining themes with Omelette and Python

Simply put, a theme is a collection of templates, images, CSS, JavaScript, and other files (such as Python scripts) that control the appearance of your site.

Typically these files are packaged into a Python package, installed in your Plone site with the help of Buildout, and installed in Plone via the Add/Remove Products configlet in Site Setup.

Once installed, certain elements of the theme can be edited through the Web using the ZMI. However, these changes only exist in the site’s database. Currently there is no easy way to transfer changes made through the Web from the database to the filesystem; so there is a trade-off for performing such customizations through the Web. If you lose your database, you lose your customizations.

Depending on your goals, it may not be entirely undesirable to store customizations in your database. But nowadays, most folks choose to separate their site’s logical elements (for example themes, add-on functionality, and so on) from their site’s content (that is data).

Creating a filesystem theme and resisting the urge to customize it through the Web accomplishes this goal. Otherwise, if you are going to customize your theme through the Web, consider these changes volatile, and subject to loss.

Packt

Share
Published by
Packt

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago