Cal. Penal Code § 626.9
(c) Subdivision (b) does not apply to the possession of a firearm under any of the following circumstances:
(2)
(d) Except as provided in subdivision (b), it shall be unlawful for any person, with reckless disregard for the safety of another, to discharge, or attempt to discharge, a firearm in a school zone as defined in paragraph (4) of subdivision (e).
The prohibition contained in this subdivision does not apply to the discharge of a firearm to the extent that the conditions of paragraph (1) of subdivision (c) are satisfied.
(e) As used in this section, the following definitions shall apply:
(f)
(2) A person who violates subdivision (b) by possessing a firearm within a distance of 1,000 feet from the grounds of a public or private school providing instruction in kindergarten or grades 1 to 12, inclusive, shall be punished as follows:
(A) By imprisonment pursuant to subdivision (h) of Section 1170 for two, three, or five years, if any of the following circumstances apply:
(g)
(o) This section does not apply to an honorably retired peace officer authorized to carry a concealed or loaded firearm pursuant to any of the following:
(q)