Пример #1
0
def manage_following_post_(request):
    form = request.web_input(userid="", submit="", collect="", char="", stream="", journal="")

    watch_settings = followuser.WatchSettings()
    watch_settings.submit = bool(form.submit)
    watch_settings.collect = bool(form.collect)
    watch_settings.char = bool(form.char)
    watch_settings.stream = bool(form.stream)
    watch_settings.journal = bool(form.journal)
    followuser.update(request.userid, define.get_int(form.userid), watch_settings)

    raise HTTPSeeOther(location="/manage/following")
Пример #2
0
def manage_following_post_(request):
    form = request.web_input(userid="", submit="", collect="", char="", stream="", journal="")

    watch_settings = followuser.WatchSettings()
    watch_settings.submit = bool(form.submit)
    watch_settings.collect = bool(form.collect)
    watch_settings.char = bool(form.char)
    watch_settings.stream = bool(form.stream)
    watch_settings.journal = bool(form.journal)
    followuser.update(request.userid, define.get_int(form.userid), watch_settings)

    raise HTTPSeeOther(location="/manage/following")
Пример #3
0
    def POST(self):
        form = web.input(userid="", submit="", collect="", char="", stream="", journal="")

        watch_settings = followuser.WatchSettings()
        watch_settings.submit = bool(form.submit)
        watch_settings.collect = bool(form.collect)
        watch_settings.char = bool(form.char)
        watch_settings.stream = bool(form.stream)
        watch_settings.journal = bool(form.journal)
        followuser.update(self.user_id, define.get_int(form.userid), watch_settings)

        raise web.seeother("/manage/following")
Пример #4
0
    def test_update(self):
        user1 = db_utils.create_user()
        user2 = db_utils.create_user()

        # user1 watches user2
        followuser.insert(user1, user2)

        # user1 updates watch settings
        followuser.update(user1, user2, followuser.WatchSettings.from_code("cf"))
        self.assertEqual("cf", d.sessionmaker().query(orm.Follow).first().settings)

        # again
        followuser.update(user1, user2, followuser.WatchSettings.from_code("st"))
        self.assertEqual("st", d.sessionmaker().query(orm.Follow).first().settings)
Пример #5
0
    def test_update(self):
        user1 = db_utils.create_user()
        user2 = db_utils.create_user()

        # user1 watches user2
        followuser.insert(user1, user2)

        # user1 updates watch settings
        followuser.update(user1, user2, followuser.WatchSettings.from_code("cf"))
        self.assertEqual("cf", d.sessionmaker().query(orm.Follow).first().settings)

        # again
        followuser.update(user1, user2, followuser.WatchSettings.from_code("st"))
        self.assertTrue(profile.select_relation(user1, user2)["follow"])
        self.assertTrue(profile.select_relation(user2, user1)["follower"])
        self.assertEqual("st", d.sessionmaker().query(orm.Follow).first().settings)
Пример #6
0
    def POST(self):
        form = web.input(userid="",
                         submit="",
                         collect="",
                         char="",
                         stream="",
                         journal="")

        watch_settings = followuser.WatchSettings()
        watch_settings.submit = bool(form.submit)
        watch_settings.collect = bool(form.collect)
        watch_settings.char = bool(form.char)
        watch_settings.stream = bool(form.stream)
        watch_settings.journal = bool(form.journal)
        followuser.update(self.user_id, define.get_int(form.userid),
                          watch_settings)

        raise web.seeother("/manage/following")