Don't query database needlessly in get_ancestors.

If the section knows it has no parent, it can just return itself.
Fixes #336, thanks to James McKinney for the suggestion.
Merge branch 'issues/336-shortcut-get-ancestors'