In the 3-quart saucepan, sauté the onions in the olive oil until the onions are tender but not browned, about 10 minutes. Stir in the flour and cook for about 3 minutes. Do not brown.
Stir in the tomatoes, sugar, garlic, herbs, and seasonings. Cover the pan and cook slowly for about 10 minutes, so the tomatoes will render more of the juice. Uncover and simmer for about 30 minutes. Add spoonfuls of water or tomato juice as necessary if the puree becomes too thick. The puree is done when it tastes thoroughly cooked and is thick enough to form a mass on the spoon. Remove the herb bouquet (or individual parsley and thyme sprigs and bay leaf). If the puree needs a little extra color, add 1 to 2 tablespoons of tomato paste. Taste and add salt and pepper as necessary. (You can make this ahead and keep in the refrigerator for up to 3 days or in the freezer.)
Preheat the oven to 375° F/190° C.
Eggplant
Halve the eggplant vertically and cut into ⅜-inch (~1 cm) slices.
Bring water to boil in the 4 to 5-quart saucepan. Add salt, about 1-½ teaspoons per quart, and place eggplant slices in the hot water, about 10 to 12 at a time. Cook just for 2 minutes, then remove from the water with a skimmer or slotted spoon. Drain on the tray lined with paper towels. Pat the slices dry.
In the skillet, pour a layer of olive oil about ⅛-inch (3 mm) thick. Heat till very hot but not smoking. Sauté eggplant slices about 1 minute on each side, and remove to the platter. Add more olive oil as necessary for the rest of the eggplant.
Assemble
In the oiled gratin dish, arrange the eggplant slices purple side up in overlapping rows, with tomato sauce and cheese slices between each row. Pour about ½ cup of the tomato puree on top.
Bake
Place the gratin dish on the cooktop and heat briefly until the sauce starts to bubble. Cover loosely with foil and bake in the preheated oven for 45 to 60 minutes. Remove the foil during the last 10 minutes to brown the cheese and thicken the liquid. Serve hot.