a blog by Marius Gedminas

Another 770

Bought another Nokia 770. Upgraded both to the IT2006 software version. One will make a nice e-book reader for my mother.

Wow, OS2006 is a big improvement! Spent the whole day installing various software packages and playing with them. Xchat is now usable (wifi connection loss bug seems to be gone), PDF reader is much faster, application menus are configurable, apt-get rules. The audio player wants to get online for obscure reasons when I just want to listen to some mp3 from my playlist. (This last point is not an improvement.)

Set up scratchbox for Maemo 2.0. Managed to port gweather-maemo to the new OS version. Happy.

Screenshot of the home view

Discovered that my old charger is nearly broken. Bought a random compatible charger (the local vendor did not have an official one). Noticed that it is not quite compatible (4.5-10 V and max 600 mA output instead of 5 V and 890 mA). Not happy.

Easy Zope 3 forms with formlib: add forms.

A short tutorial of zope.formlib.

Here's how you create an add form for a notional content object Fruit:

# This is the mypackage.browser module
from zope.formlib import form

from mypackage.interfaces import IFruit
from mypackage.fruit import Fruit

class FruitAdd(form.AddForm):

    form_fields = form.Fields(IFruit)

    def create(self, data):
        # In our example Fruit class has an __init__
        # that accepts all the fields as keyword arguments
        return Fruit(**data)

Here's how you register it in ZCML

<browser:page
    for="zope.app.container.interfaces.IAdding"
    name="mypackage.Fruit"
    class="mypackage.browser.FruitAdd"
    permission="zope.ManageContent"
    />

<browser:addMenuItem
    title="Fruit"
    class="mypackage.fruit.Fruit"
    view="mypackage.Fruit"
    permission="zope.ManageContent"
    />

Here's a zip file with full working code: formlib-adding-example.zip

Update: changed the link to point to the up-to-date version of zope.formlib.

Update: Martijn Pieters shows how to use the handy applyChanges function when you do not have a constructor that takes all the parameters.

EuroPython 2006

Python

Last week I was at the EuroPython 2006 conference in CERN, Geneva.

CERN has WiFi coverage everywhere. I felt like I was in the future. Nokia 770 is a wonderful little device when there's WiFi everywhere. I never had to pull out my laptop from the backpack (except during my talk). After three months of constant usage I can say that am very happy with my 770. (A few other folks also had 770s, but not everyone was happy with them.)

I noticed at least three people using GTimeLog. I feel bad about not making a proper release...

It was nice to see familiar faces again, although I missed some of them (Beatrice Fontaine, Laura Creighton, Andy Robinson, Michael Salib).

Interesting things that I want to look into, time permitting: pydoctor, astng, bzr, Zope 3 cookbook.

Some of the talks were streamed over the Internet (live) because the speakers were ill. One of these was the (very good) keynote by Alan Kay. Squeak is impressive.

The only thing that wasn't very good this year was the lack of community space for socializing during lunch or in the evenings. The next conference is going to be in Vilnius. It will be hard to surpass this one...