Pursuance Thereof. The provisions of this Charter may be pleaded and shall be a defense to any action brought against the mayor and aldermen, or either, when the acts of the mayor and aldermen are in accordance with ordinances properly passed in pursuance thereof.