There are a few places in the code that rely on catching the
RuntimeError generated by trying to access a flag that does not exist. This is going to be replaced by an
AttributeError more inline with python's rules.
In preparation, this MR changes these calls to use the
hasFlag method, which is clearer in any case.