For individual round ring moulds or a round dish/tin cut the aubergine and courgette into rounds. For a lasagne/brownie tray cut the vegetables lengthwise into long strips.
Remove the stalk, then slice the aubergine into 3mm rounds or strips. Put them in a large colander, sprinkle with salt and leave to marinate for 20-30 minutes.
Put the chopped tomato pulp into a saucepan. Fill the can half-full with water, to rinse out the remaining juice and pour it into the saucepan. Add the sugar, salt and pepper. Simmer for 20-30 minutes on medium heat to reduce and thicken the sauce. It should be very thick, but not sticking to the base of the pan.
While the sauce is simmering you can cook the vegetables. Slice the courgettes into 3mm rounds or strips.
In a large frying pan, heat 2 tbsp olive oil and fry the courgette slices in batches of a single layer, turning halfway through, until they start to show nice brown colouring. With a palette knife or tongs lay them on a tray lined with absorbent kitchen paper. Season the cooked courgettes with salt and pepper
Rinse the aubergines slices, lay them out on a clean tea towel and pat them dry.
In the same pan, heat another 2 tbsp olive oil and fry the aubergine slices in a similar way. When all done, again place onto a lined tray and season them.
To peel the tomato, using the tip of a sharp knife remove the top core. Boil a full kettle, put the tomato into a deep jug and pour on enough boiling water to cover it .Leave for 2 minutes then pour off the boiling water, fill the jug with cold water and leave the tomato to cool for a couple of minutes. Now using the point of a knife you can gently ease away and pull off the skin.
Cut the tomato in half vertically, then place each half flat side down and with a very sharp knife cut into 3-4 mm slices. Some off the juice will dribble out, don't worry that's fine.
Now its time to build your gateau.
If you are using a larger dish, tin or tray, cut a piece of baking paper to fit just the base. Then oil the base and sides. If using individual moulds, cut squares or rounds of baking paper just larger than the mould, put them on a tray and place the moulds on the paper.
To build in a larger tin, layer courgette; aubergine; tomato; tomato sauce; courgette; aubergine; pesto; courgette.
To build in a smaller ring mould, first place a smaller courgette round in the centre of the ring, then place 5 of the smaller ones around it so they reach the edges of the mould .Then repeat the layers as stated above. It can help make more even layers by cutting the aubergine slices in half and placing them, as well as the tomato slices, with the round side snug to the ring.
Chill for an hour at least before inverting the dish and turning it out with a sharp tap on your work board. Peel off the paper, garnish with basil leaves and serve.