Archive for the ‘zope’ Category

Greenwich Tweets

Sunday, May 10th, 2009

I’m slowly getting the ball rolling with an idea I’ve had for a while called Greenwich Tweets. The idea behind this is to aggregrate information about Greenwich (London) from a number of Web resources, principally Twitter.

So far I haven’t done much more than register a Twitter account (@greenwichtweets) and domain name (greenwichtweets.co.uk) and browse some of the API documentation. Updates on progress will be available on the Greenwich Tweets site (which at the moment is just redirecting to a page on this site!). I’m hoping to start work in earnest around July.

At the moment I’m looking at Python and Zope (possibly Plone) to manage the back-end stuff, although I’m hoping to keep it all reasonably lightweight.

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.

Plone and Flash Player 10

Friday, October 17th, 2008

Another pyrrhic victory maybe, but something that has made me exceptionally happy this afternoon. Basically, yesterday I upgraded my version of Flash Player to version 10 only to find that the Flash files on our Plone-powered site no longer worked.

The lovely folks at SWFObject helped to identify why this was happening — nothing to do with SWFObject at all but the fact that Flash Player 10 implements some new security “features”. I managed to isolate it to the fact that Plone serves up ATFiles with the header, “Content-Disposition: attachment”. Flash Player 10 ignores files served up with this header, so you need to override this and set it to “Content-Disposition: inline;”.

I came up with this solution which may not be overly elegant but at least it works. I created a skin-level Python script that sets response headers before returning the file:

showflash.py

request = container.REQUEST
RESPONSE =  request.RESPONSE
flashvid = request['flashvid']
cd = 'inline; filename=%s' %(context.id)
RESPONSE.setHeader('Content-Disposition', cd)
return context[flashvid]

Then, when I embed the video with SWFObject I call it thus,

<script type="text/javascript">
   swfobject.embedSWF("&dtml-portal_url;/path/to/flash/showflash?flashvid=myflash.swf", "my-dom-id", "435", "290", "9.0.115");
</script>

This may be better handled by a product like Plone4Artists Video but it certainly works as a fix for us.