Go back to getattr.

The original change at https://reviews.reviewboard.org/r/4241/ used getattr,
and I (David) changed it to hasattr because I'm dumb. Trivial update.