1. Place flour, sugar, salt, and margarine in a food processor fitted with the knife attachment. Process until coarse crumbs form. Add water one tablespoon at a time until a dough forms. Shape dough into a disk, wrap in plastic wrap, and chill for one hour.
2. Preheat oven to 350 degrees Fahrenheit (180 degrees Celsius). On a floured surface, using a floured rolling pin, roll dough into an 11-inch (28-cm) circle. Fit dough into a 9-inch (23-cm) tart pan with a removable bottom. Trim dough even with top of pan. Line crust with aluminum foil; fill with pie weights or dried beans. Bake crust until just set, 12-15 minutes. Transfer pan to a wire rack to cool. Remove foil and weights.
This dough can be made in advance and frozen. Also, if you prefer a more piquant flavored pie, add any or all of the following: a few crushed thyme leaves added to the custard, a pinch of nutmeg (recommended), or two tablespoons white wine added to the onions.