def has_permission_to_view(page, user):
if page.permissions.count() == <NUM_LIT:0>:<EOL><INDENT>return True<EOL><DEDENT>for perm in page.permissions.all():<EOL><INDENT>perm_label = '<STR_LIT>' % (perm.content_type.app_label, perm.codename)<EOL>if user.has_perm(perm_label):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>
Check whether the user has permission to view the page. If the user has
any of the page's permissions, they have permission. If the page has no set
permissions, they have permission.