Wash the aubergines. Remove the stems and cut into 1cm pieces. Place in a colander and sprinkle with salt. Cover the aubergines with a plate and put something heavy on top. Leave for 1 hour until they release their bitter juices. Dry with a dish towel or absorbent paper.

In a frying-pan, heat a little of the olive oil and gently fry the onion. When it starts to turn golden, add the celery. Fry and add the tomatoes. Simmer gently until a little of the liquid has been reduced. Add the olives, capers, sugar, vinegar and a pinch of ground black pepper and cook gently.

In another frying-pan, heat the rest of the oil and cook the aubergines until soft. Mix with the other ingredients and season lightly with salt. Cook for a few more minutes and then leave to rest. When the caponata has cooled down, adjust the sweet and sour souce as required by adding more sugar or vinegar.