def wrapped(self, *args, **kwargs): if users.get_current_user() and self.userprofile is None: if users.is_current_user_admin(): self.userprofile = Profile.create(user=users.get_current_user()) else: redirect_to = '/user/profile/create?next={0}'.format(self.request.path + (self.request.query and ('?' + self.request.query) or '')) return self.redirect(redirect_to) return fn(self, *args, **kwargs)
def userprofile(self): if users.get_current_user(): return Profile.by_user(users.get_current_user())