Tuesday, January 25, 2011

Buildout error: Products.CMFPlone 4.1a1 requires 'Zope2>2.13.0'.

When running my Plone 4.0.2 buildout, i got this error:

We already have: Zope2 2.12.13
but Products.CMFPlone 4.1a1 requires 'Zope2>2.13.0'.

But where did i say i wanted to use Plone 4.1a1? It seems packages which depend on Products.CMFPlone (like plone.app.registry) by default (when running buildout without the -N switch) get the latest version, which is 4.1a1. And this, in turn, tries to pull in the rest of Plone 4.1.

This doesn't happen with Plone 4.0.3, as http://dist.plone.org/release/4.0.3/versions.cfg does the pinning, so upgrading to 4.0.3 is the best option.

Wednesday, January 19, 2011

Why is my Data.fs so big?

If your Data.fs is still big after packing, here are some tricks you might try to find out why it is big.

1. Write a custom script (example see below) that does a catalog query and returns each brain's getObjSize(). This will only find catalog'ed objects, but these are probably the ones that make your Data.fs big.

2. Check portal_historiesstorage to see how many old versions of objects are stored, and how big these objects are. Maybe there's this one news item with a 4Mb image of which there are 365 versions.

3. Check portal_purgepolicy's setting: by default it will keep an infinite number of versions (-1).

Thanks to Huub for these tips.

# example script to get a list of large content objects
from Products.CMFCore.utils import getToolByName

catalog = getToolByName(context, 'portal_catalog')
total = 0
for r in catalog():
size_str = r.getObjSize
(num, pow) = size_str.split(' ')
num = float(num)
if pow == 'kB':
size = num*1
if pow == 'MB':
size = num*1000
size = int(size)
if size > 100:
print size, r.getURL()
total = total + size

print "Total %s kB" % total
return printed

Wednesday, January 12, 2011

Scrape a Picasa web album

A friend shared a Picasa album with me, but i couldn't download it. Picasa Webalbums Assistant to the rescue, thanks Bradley. Works on Ubuntu too, does just what i wanted.

Monday, January 3, 2011

Making cron send mail to an external address

So, you've filled in "me@example.com" as your address in your crontab's MAILTO field, but nothing happens. Probably you're getting a message like "Mailing to remote domains not supported".

There's an easy way to send mail to an external address from a cron job: set up
http://untroubled.org/nullmailer/. It asks you for the address of an SMTP server and uses that to send your precious update notifications of that remote server you never log in on anymore.

If you have accidentally installed another mail program (like mailutils), you can dpkg-reconfigure nullmailer to make it work again.