def can_view_app(req, dom):
    if ((not dom) or (not dom.is_snapshot) or (not dom.published)):
        return False
    if ((not dom.is_approved) and ((not getattr(req, 'couch_user', '')) or (not req.couch_user.is_domain_admin(dom.copied_from.name)))):
        return False
    return True
def can_view_app(req, dom):
    if ((not dom) or (not dom.is_snapshot) or (not dom.published)):
        return False
    if ((not dom.is_approved) and ((not getattr(req, 'couch_user', )) or (not req.couch_user.is_domain_admin(dom.copied_from.name)))):
        return False
    return True