def role_required(role):
    def wrap(view_func):
        def has_role(self, *args, **kwargs):
            if not self.current_user:
                if self.request.method == "GET":
                    url = self.get_login_url()
                    if url not in "?":
                        url += "?" + urllib.urlencode(dict(next=self.request.uri))
                    self.redirect(url)
                    return
                raise HTTPError(403)
            else:
                if not self.current_user.has_role(role):
                    self.flash.error = "You do not have permissions to access the requested url"
                    self.redirect('/')
                    return

                return view_func(self, *args, **kwargs)

        return has_role
    return wrap
dataset/ETHPy150Open trendrr/whirlwind/whirlwind/view/decorators.py/role_required/swapped operands of `not in`