Fix API write assert

Cyclic recusion was introduced in
I80971cde07651a042ef6472dc1a81cb4a1704742

Use _extensions instead of _siteinfo to determine whether to
check the list of extensions.

Also wrap clauses in brackets to dictate precedence of the
and/or operators.

Change-Id: I19858792673d2a22417f8cd41e2a2881a725b189