コード例 #1
0
def unfollowuser_(request):
    form = request.web_input(userid="")
    form.otherid = define.get_int(form.userid)

    followuser.remove(request.userid, form.otherid)

    raise HTTPSeeOther(location="/manage/following")
コード例 #2
0
ファイル: interaction.py プロジェクト: Syfaro/weasyl
def unfollowuser_(request):
    form = request.web_input(userid="")
    form.otherid = define.get_int(form.userid)

    followuser.remove(request.userid, form.otherid)

    return Response(define.errorpage(
        request.userid, "**Success!** You are no longer following this user.",
        [["Go Back", "/manage/following"], ["Return Home", "/"]]))
コード例 #3
0
ファイル: interaction.py プロジェクト: weykent/weasyl
    def POST(self):
        form = web.input(userid="")
        form.otherid = define.get_int(form.userid)

        followuser.remove(self.user_id, form.otherid)

        return define.errorpage(
            self.user_id, "**Success!** You are no longer following this user.",
            [["Go Back", "/manage/following"], ["Return Home", "/"]])
コード例 #4
0
ファイル: interaction.py プロジェクト: greysteil/wzl-test
def unfollowuser_(request):
    form = request.web_input(userid="")
    form.otherid = define.get_int(form.userid)

    followuser.remove(request.userid, form.otherid)

    return Response(
        define.errorpage(
            request.userid,
            "**Success!** You are no longer following this user.",
            [["Go Back", "/manage/following"], ["Return Home", "/"]]))
コード例 #5
0
ファイル: test_followuser.py プロジェクト: weykent/weasyl
    def test_remove(self, followuser_remove):
        user1 = db_utils.create_user()
        user2 = db_utils.create_user()

        # user1 watches user2
        followuser.insert(user1, user2)
        self.assertEqual(1, d.sessionmaker().query(orm.Follow).count())

        followuser_remove.reset_mock()

        # user1 changed their mind
        followuser.remove(user1, user2)
        self.assertEqual(0, d.sessionmaker().query(orm.Follow).count())
        followuser_remove.assert_called_once_with(user1, user2)
コード例 #6
0
ファイル: interaction.py プロジェクト: Syfaro/weasyl
def followuser_(request):
    form = request.web_input(userid="")
    otherid = define.get_int(form.userid)

    if request.userid == otherid:
        return Response(define.errorpage(request.userid, "You cannot follow yourself."))

    if form.action == "follow":
        if not followuser.check(request.userid, otherid):
            followuser.insert(request.userid, otherid)
    elif form.action == "unfollow":
        followuser.remove(request.userid, otherid)

    raise HTTPSeeOther(location="/~%s" % (define.get_sysname(define.get_display_name(otherid))))
コード例 #7
0
ファイル: interaction.py プロジェクト: weykent/weasyl
    def POST(self):
        form = web.input(userid="")
        otherid = define.get_int(form.userid)

        if self.user_id == otherid:
            return define.errorpage(self.user_id, "You cannot follow yourself.")

        if form.action == "follow":
            if not followuser.check(self.user_id, otherid):
                followuser.insert(self.user_id, otherid)
        elif form.action == "unfollow":
            followuser.remove(self.user_id, otherid)

        raise web.seeother("/~%s" % (define.get_sysname(define.get_display_name(otherid))))
コード例 #8
0
def followuser_(request):
    form = request.web_input(userid="")
    otherid = define.get_int(form.userid)

    if request.userid == otherid:
        raise WeasylError("cannotSelfFollow")

    if form.action == "follow":
        followuser.insert(request.userid, otherid)
    elif form.action == "unfollow":
        followuser.remove(request.userid, otherid)

    raise HTTPSeeOther(location="/~%s" %
                       (define.get_sysname(define.get_display_name(otherid))))
コード例 #9
0
ファイル: test_followuser.py プロジェクト: 0x15/weasyl
    def test_remove(self, followuser_remove):
        user1 = db_utils.create_user()
        user2 = db_utils.create_user()

        # user1 watches user2
        followuser.insert(user1, user2)
        self.assertEqual(1, d.sessionmaker().query(orm.Follow).count())

        followuser_remove.reset_mock()

        # user1 changed their mind
        followuser.remove(user1, user2)
        self.assertEqual(0, d.sessionmaker().query(orm.Follow).count())
        followuser_remove.assert_called_once_with(user1, user2)
コード例 #10
0
ファイル: interaction.py プロジェクト: greysteil/wzl-test
def followuser_(request):
    form = request.web_input(userid="")
    otherid = define.get_int(form.userid)

    if request.userid == otherid:
        return Response(
            define.errorpage(request.userid, "You cannot follow yourself."))

    if form.action == "follow":
        if not followuser.check(request.userid, otherid):
            followuser.insert(request.userid, otherid)
    elif form.action == "unfollow":
        followuser.remove(request.userid, otherid)

    raise HTTPSeeOther(location="/~%s" %
                       (define.get_sysname(define.get_display_name(otherid))))