Archive for the ‘plone’ Category

Fancy helping with plonetheme.hamnavoe?

Friday, April 10th, 2009

Hamnavoe is one of my contributions to the Out of the Box Plone Themes project and has had almost 500 downloads since its release last October.

I’ve been meaning to do some minor fixes (mainly CSS) on it for a while now but am too bogged down with other things to be able to give it any time.

So … this could be where you come in. If you’re a budding Plone themer and would like to have a poke around with an existing Plone 3 theme before starting on your own, then this could be an opportunity for you to help out. It’s for the community (i.e. it’s not my own private project!), so the reward would really just be in doing it (and getting your name in the documentation obviously).

Ok, so don’t all rush at once. But, seriously, if you’re interested, drop me an email at my Gmail address: d.little1971 (at gmail.com) or send me a Tweet: @djlittle.

Plone theming: some minor annoyances and victories

Saturday, January 17th, 2009

I’ve started work in earnest on theming a Plone 3 site this week and have come up against some minor annoyances. But, this was balanced out by some of the cool things I learned too.

Portlets.xml

One of the great things about generic setup is that you can configure your site through the web and then export your settings as a series of xml files to your filesystem theme product. However, configuring my portlets and then exporting the resulting portlets.xml file caused some problems when re-installing the product.

I’d customised my navigation following the steps outlined in the article Customising navigation in Plone 3. This was fine. But when I re-installed my theme product containing an exported portlets.xml file I got a “ConstraintNotSatisfied” error. I didn’t get very far with finding a solution to this on Google, but by trial and error found out that this disappeared if I removed the following from the <assignment name=”navigation” …/> directive:

<property name=”name” />
<property name=”bottomlevel”/>
<property name=”root” />

Secondly, default portlets (login, news, recent etc.) I’d removed via “manage portlets” weren’t reflected in my portlets.xml file so I had to enter this manually into my portlets.xml file:

<assignment remove=”true” name=”login” category=”context” key=”/”
manager=”plone.leftcolumn” type=”portlets.Login” />
<assignment remove=”true” name=”calendar” category=”context” key=”/”
manager=”plone.rightcolumn” type=”portlets.Calendar” />
<assignment remove=”true” name=”events” category=”context” key=”/”
manager=”plone.rightcolumn” type=”portlets.Events” />
<assignment remove=”true” name=”news” category=”context” key=”/”
manager=”plone.rightcolumn” type=”portlets.News” />
<assignment remove=”true” name=”recent-items” category=”context” key=”/”
manager=”plone.rightcolumn” type=”portlets.recent” />
<assignment remove=”true” name=”review-list” category=”context” key=”/”
manager=”plone.rightcolumn” type=”portlets.review” />

CSS Registry

To ensure that the order of CSS files in the CSS Registry was honoured I had to enable the auto grouping property (which didn’t exist in Plone 2.5.3). In the cssregistry.xml you can set this via:

<object name=”portal_css” meta_type=”Stylesheets Registry” autogroup=”True”> … </object>

The order seemed to go a bit haywire again if I enabled debug mode in the CSS Registry.

More positive things

It’s pretty straightforward to override viewlets for different content types. For instance, I didn’t want the breadcrumb trail to appear on my home page. In my browser/configure.zcml I simply added this directive:

<browser:viewlet
name=”bbkschool.path_bar”
manager=”plone.app.layout.viewlets.interfaces.IContentViews”
for=”Products.BBKHomePage.interfaces.IBBKHomePage”
layer=”.interfaces.IThemeSpecific”
template=”nopath_bar.pt”
permission=”zope2.View” />

In the “for” attribute I specify the interface of the content type I want this to apply to. The template, “nopath_bar.pt” is simply an empty template in my browser directory.

Lastly, Gloworm came in really handy as did plone.reload (although I found this a little unpredictable at times).

Migrating from Zope 2.6.4 to Plone 2.5.3

Thursday, December 11th, 2008

I’m currently working on the roll-out of Plone 2.5.3 sites to replace our old Zope 2.6.4 / CMF 1.4.2 sites (Plone 3 to come for new sites in the new year hopefully). I can safely say that after doing this a few times, migrating from such an old version of plain Zope/CMF to a relatively new version of Plone is a complete nightmare.

The number of steps I’ve had to go through to get this working seems to get larger every time I do it. I’ve now got to stage where I’m not 100% sure if a step is needed or not, but what the hell I’m going to do it anyway. To be honest, I’d probably recite incantations backwards over a boiling cauldron if I thought that was going to help.

Here’s a summary of what I’ve had to do:

  • Export the content from the old Zope 2.6.4 site
  • Create a new CMF site on a Zope 2.9.7 instance
  • Run through a load of Zope upgrade routines,  including fixing the catalog and adding a load of new folder actions
  • Export the folder(s) containing the content you want to migrate
  • Create a new Plone site somewhere on a trashable Zope 2.9.7 instance
  • Set this up with a theme / policy product
  • Import the converted Zope/CMF folders
  • Clear and rebuild the Plone site’s portal catalog
  • Go to portal_atct / Type migration and click on “Fix” under “Fix portal names”
  • Click on “Migrate” under “Type migration”
  • This should fix all old CMF documents, links and files
  • Now, I’ve got the fix the old CMF Folders. Oh, this is a good one. The only way to get these into the catalog is to go to portal_catalog and go to “Find Objects”. I leave the search fields blank to get absolutely everything into the catalog, even stuff that doesn’t really belong there
  • I create a migration script that handles the transfer of old “Portal Folders” to Plone Folders (not at the ATFolders stage yet). It also does some other minor migrations I need to do (e.g. converting ATDocuments to a custom content type)
  • Here’s another great one: now make sure your folders don’t contain any objects with the IDs of “language” or “subject”. This causes the migration to fail (I found this out by trial and mainly error). There may be some more IDs that cause this problem, I don’t know.  Rename any verboten IDs.
  • Go back to portal_catalog and do a Clear and Rebuild
  • Go back to portal_atct and re-rerun Migrate Types. My Plone Folders now become ATFolders (woohoo!). Oh hang on, they don’t have any titles!
  • I write a script that gives the folders the same titles as their index_html documents. Luckily, by and large the titles of folders and their index pages are the same, so this usually works.

That’s it. Simple and pain-free it’s not. But it is a good advert for not leaving it so long between upgrading your Zope/Plone versions, or being a better programmer.