Heat the oil in a saucepan, add the onion and fry for 5 minutes until softened. Add the garlic, courgette and diced peppers and fry briefly, then add the tomatoes, herbs, sugar and a little salt and pepper. Simmer, uncovered, for 10 minutes, stirring from time to time until thickened. Cool.
Make the pastry. Add the flour, butter and a little salt and pepper to a bowl, rub in the butter until you have fine crumbs, then stir in the cheese. Add the egg yolks and water and mix to form a smooth dough.
Knead lightly, then cut the dough into 4 pieces. Roll one of the pieces out between 2 sheets of clingfilm, patting into a neat shape until you have an 18 cm (7 inch) circle. Remove the top sheet of clingfilm, spoon one-quarter of the filling in the centre, brush the pastry edges with beaten egg, then fold the pastry circle in half while still on the lower piece of clingfilm.
Peel the pastry off the film, lift on to an oiled baking sheet, press the edges together well and press together any breaks in the pastry. Repeat with the remaining pastry pieces and filling until 4 pies have been made.
Brush with beaten egg, sprinkle with a little extra cheese and bake in a preheated oven, 190°C (375°F), Gas Mark 5, for 20 minutes until golden brown. Loosen and transfer to a wire rack. Serve warm or cold with salad.