def _rate_url(self, poll, position): params = {'url': h.entity_url(poll, member='rate'), 'token_param': h.url_token(), 'position': position, 'cls': self.widget_size} return ("%(url)s?position=%(position)d&" "%(token_param)s&cls=%(cls)s") % params
def _rate_url(self, poll, position): params = { "url": h.entity_url(poll, member="rate"), "token_param": h.url_token(), "position": position, "cls": self.widget_size, } return ("%(url)s?position=%(position)d&" "%(token_param)s&cls=%(cls)s") % params
def _login(self, user): """ log the user in and redirect him to a sane place. """ login_user(user, request) if c.instance and not user.is_member(c.instance): redirect(h.base_url("/instance/join/%s?%s" % (c.instance.key, h.url_token()))) redirect("/")
def _rate_url(self, poll, position): params = { 'url': h.entity_url(poll, member='rate'), 'token_param': h.url_token(), 'position': position, 'cls': self.widget_size } return ("%(url)s?position=%(position)d&" "%(token_param)s&cls=%(cls)s") % params
def link_with_untag(tag, delegateable, simple=True): tag_link = link(tag, simple=simple) if can.instance.edit(c.instance): return '%s (%s)' % (tag_link, '<a href="%s?tag=%d&delegateable=%d&%s">%s</a>' % (base_url('/untag_all'), tag.id, delegateable.id, url_token(), _('delete'))) else: return tag_link
def _login(self, user): """ log the user in and redirect him to a sane place. """ login_user(user, request) if c.instance and not user.is_member(c.instance): redirect(h.base_url(c.instance, path="/instance/join/%s?%s" % (c.instance.key, h.url_token()))) redirect("/")
def _login(self, user, register=False): """ log the user in and redirect him to a sane place. """ login_user(user, request, response) session["login_type"] = "openid" if c.instance and not user.is_member(c.instance): redirect(h.base_url("/instance/join/%s?%s" % (c.instance.key, h.url_token()))) if register: redirect(h.user.post_register_url(user)) else: redirect(h.user.post_login_url(user))
def _login(self, adhocracy_user): """ Log the user in and redirect him to a sane place. """ assert adhocracy_user login_user(adhocracy_user, request, response) session['login_type'] = 'velruse' if c.instance and not adhocracy_user.is_member(c.instance): redirect(h.base_url("/instance/join/%s?%s" % (c.instance.key, h.url_token()))) redirect(h.user.post_login_url(adhocracy_user))
def _login(self, user, register=False): """ log the user in and redirect him to a sane place. """ login_user(user, request, response) session['login_type'] = 'openid' if c.instance and not user.is_member(c.instance): redirect( h.base_url("/instance/join/%s?%s" % (c.instance.key, h.url_token()))) if register: redirect(h.user.post_register_url(user)) else: redirect(h.user.post_login_url(user))
def link_with_untag(tag, delegateable, simple=True): tag_link = link(tag, simple=simple) if can.instance.edit(c.instance): return '%s (%s)' % ( tag_link, '<a href="%s?tag=%d&delegateable=%d&%s">%s</a>' % ( base_url('/untag_all'), tag.id, delegateable.id, url_token(), _('delete') ) ) else: return tag_link
def _login(self, adhocracy_user, redirect_url=None): """ Log the user in and redirect him to a sane place. """ assert adhocracy_user login_user(adhocracy_user, request, response) session['login_type'] = 'velruse' if redirect_url is None: if c.instance and not adhocracy_user.is_member(c.instance): redirect( h.base_url("/instance/join/%s?%s" % (c.instance.key, h.url_token()))) else: redirect(h.user.post_login_url(adhocracy_user)) else: redirect(redirect_url)
def _login(self, user): """ Raw login giving severe headaches to repoze.who, repoze.what and any bystanding squirrels. """ identity = { 'userdata': '', 'repoze.who.userid': str(user.user_name), 'timestamp': int(datetime.utcnow().strftime("%s")), 'user': user, } # set up repoze.what who_plugins = request.environ['repoze.who.plugins'] authorization_md = who_plugins['authorization_md'] authorization_md.add_metadata(request.environ, identity) auth_tkt = request.environ['repoze.who.plugins']['auth_tkt'] header = auth_tkt.remember(request.environ, identity) response.headerlist.extend(header) if c.instance and not user.is_member(c.instance): redirect(h.base_url(c.instance, path="/instance/join/%s?%s" % (c.instance.key, h.url_token()))) redirect("/")