If using fresh tomatoes, core them, cut them into coarse chunks, and puree them in a food processor, blender, or food mill until smooth. Strain the flesh of canned tomatoes through a fine sieve, to remove skins and seeds. Set aside.
Heat the olive oil in a large pot, and cook the onion over a medium heat, stirring, until soft.
Add the garlic and cook, stirring occasionally, until it becomes soft. Do not let the garlic brown, or an acid taste will be imparted in the sauce.
Add the remaining ingredients, reduce the heat to low, and simmer until thickened, about 15 minutes.