Exemple #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")
Exemple #2
0
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", "/"]]))
Exemple #3
0
    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", "/"]])
Exemple #4
0
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", "/"]]))
Exemple #5
0
    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)
Exemple #6
0
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))))
Exemple #7
0
    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))))
Exemple #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))))
Exemple #9
0
    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)
Exemple #10
0
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))))