コード例 #1
0
ファイル: poll_tiles.py プロジェクト: whausen/part
 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
コード例 #2
0
ファイル: poll_tiles.py プロジェクト: alkadis/vcv
 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
コード例 #3
0
ファイル: openidauth.py プロジェクト: aoeztuerk/adhocracy
 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("/")
コード例 #4
0
 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
コード例 #5
0
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
コード例 #6
0
 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("/")
コード例 #7
0
ファイル: openidauth.py プロジェクト: alkadis/vcv
 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))
コード例 #8
0
ファイル: velruse.py プロジェクト: veryrandomname/adhocracy
    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))
コード例 #9
0
ファイル: openidauth.py プロジェクト: alkadis/vcv
 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))
コード例 #10
0
ファイル: tag_helper.py プロジェクト: alkadis/vcv
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
コード例 #11
0
ファイル: velruse.py プロジェクト: alkadis/vcv
    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)
コード例 #12
0
ファイル: openidauth.py プロジェクト: AnonOnWarpath/adhocracy
 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("/")