Boundedness of the Riesz projection on spaces with weights