Switch between battery and dynamo to power bicycle lights
All you need is a single power diode if it is a rechargable battery, two diodes if the battery can't be recharged.

In the first case, the battery is always connected to the light.  If the dynamo voltage is high enough, then it will dump current onto the battery-light combination.  This current will charge the battery minus whatever is used to run the light.  This setup is probably only good for a lead-acid battery, which are pretty forgiving in how they are charged.  I'm also making the assumption that the dynamo can't put out enough power to overcharge the battery, which is probably true for a normal bicycle dynamo and even a small lead-acid battery.

If the battery can't be recharged, then you have to make sure the dynamo can't force reverse current thru the battery.  In that case you need two diodes, one from the battery to the light and the other from the dynamo to the light.  In this setup, whichever of the dynamo or the battery is at higher voltage will power the light.