Wednesday, December 19, 2012

Looking for work

Update: A colleague accepted a new job somewhere else. I am staying on but will have time for projects.

Der Freitag are laying off staff. The investor's financial situation has taken a turn for the worse, and the paper doesn't yet cover its costs (German link). My job is among the ones being cut.

Having something to do during the daytime makes life more bearable, so that's something i'd like to keep going. Fortunately, there is no shortage of developer jobs in Berlin.

Plone and related technologies are among my main areas of interest, but i'm keeping an open mind. As for the setting: working in a small company would be great, i'm also open to freelance offers. I enjoy working on Free Open Source Software, Web stuff, Python, and Linux, and i'm available from february.

If you know something that might be of interest to me, i'd much appreciate your feedback!


(khink on github, irc and, LinkedIn, firstnamelastname at gmail)

Monday, December 17, 2012

Shouldn't load state for ... when the connection is closed

Update: Suspicion has been falsified, as the same error occurred again yesterday.

We got this error from our live sites. Never locally, so hard to trace. One mailing list post warned that it might indicate a "severe persistency bug" which might cause "catastrophic inconsistencies". Most people agree that it's due to code that stores objects in inappropriate places (cached views).

That felt like looking for a needle in a haystack. We did find a viewlet that in its update method stored a portal tool on the viewlet, like so:

def update(self):
super(ViewletClass, self).update()
self.workflow_tool = getToolByName(self.context, 'portal_workflow') 

After replacing that line, the messages went away after the next update. Might be that something else that went into that update caused it, but i thought i'd share my suspicion here in case anyone ever googles for this.

Thursday, September 13, 2012

How to disable WebDAV in Plone

You can't disable WebDAV in Plone itself, it's tightly integrated in Zope.

Running WebDAV on another port would be okay, but using the webdav-address directive in buildout will only add an additional port on which Zope listens (webdav-source-server part in zope.conf). The existing port will still accept WebDAV traffic.

What you can do: Make your web server filter out the WebDAV commands. For nginx, this is done by adding
            dav_methods off;
to the server block in your nginx.conf.

For Apache, see Also note the "Access WebDAV" permission referenced in a reply to that question.

Other links that helped me:

(updated 2012-09-14 to replace limit_except with dav_methods, thanks Gil Forcada)
(2012-10-07: Developer manual updated,

Tuesday, July 3, 2012

python-imaging in virtualenv with Pillow

Thanks to Pillow (fork of PIL) it's now easy to run Plone in a virtualenv. Virtualenv is quite convenient if you have different python projects (Plone, Django, Pyramid). (The virtualenvwrapper scripts make it even easier to use.)

I tried to install PIL in a virtualenv, but it could by default not find the image libraries installed on my system (Ubuntu 12.04). I did, of course, install the relevant development libraries, but the result would still be "JPEG support not available". There's tricks to work around that, but really: Pillow is much easier:
$ mkvirtualenv --no-site-packages --python=python2.7 python2.7-Pillow
(python2.7-Pillow) $ easy_install Pillow
And you're ready to run your buildout.

Wednesday, May 2, 2012

Parsing HTML output in Plone functional doctests with lxml

When writing functional doctests, i used to fumble a bit to inspect what was in the HTML. Today i looked into lxml and it makes it a lot easier to test, especially the XPath makes for very readable tests.

For example, to test that a certain text appears in a viewlet, but not in the page itself, parsing the tree of the document is convenient. (Use case: A viewlet that displays "Other Items".)

 This snippet tests our viewlet, which should at that point in the test show exactly one item:
    >>> from lxml import etree
    >>> html = etree.HTML(browser.contents)
    >>> len(html.xpath('//*[@id="other-advertorial-texts"]/div[@class="box"]'))

Tuesday, March 6, 2012

"Client has seen newer transactions than server!"

I got this error after moving a database from one server to the other on a ZODB client-server setup. The instances (ZODB clients) would be up and running, but completely unresponsive. It can be fixed by removing the "instance" parts completely and re-running buildout.