当前位置: 首页>>代码示例>>Python>>正文


Python NewThreadEvent.is_notifying方法代码示例

本文整理汇总了Python中forums.events.NewThreadEvent.is_notifying方法的典型用法代码示例。如果您正苦于以下问题:Python NewThreadEvent.is_notifying方法的具体用法?Python NewThreadEvent.is_notifying怎么用?Python NewThreadEvent.is_notifying使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在forums.events.NewThreadEvent的用法示例。


在下文中一共展示了NewThreadEvent.is_notifying方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_watch_forum

# 需要导入模块: from forums.events import NewThreadEvent [as 别名]
# 或者: from forums.events.NewThreadEvent import is_notifying [as 别名]
    def test_watch_forum(self):
        """Watch then unwatch a forum."""
        self.client.login(username='rrosario', password='testpass')
        user = User.objects.get(username='rrosario')

        f = Forum.objects.filter()[0]
        post(self.client, 'forums.watch_forum', {'watch': 'yes'},
             args=[f.slug])
        assert NewThreadEvent.is_notifying(user, f)
        # NewPostEvent is not notifying.
        assert not NewPostEvent.is_notifying(user, f.last_post)

        post(self.client, 'forums.watch_forum', {'watch': 'no'},
             args=[f.slug])
        assert not NewThreadEvent.is_notifying(user, f)
开发者ID:Akamad007,项目名称:kitsune,代码行数:17,代码来源:test_views.py

示例2: threads

# 需要导入模块: from forums.events import NewThreadEvent [as 别名]
# 或者: from forums.events.NewThreadEvent import is_notifying [as 别名]
def threads(request, forum_slug):
    """View all the threads in a forum."""
    forum = get_object_or_404(Forum, slug=forum_slug)
    if not forum.allows_viewing_by(request.user):
        raise Http404  # Pretend there's nothing there.

    try:
        sort = int(request.GET.get('sort', 0))
    except ValueError:
        sort = 0

    try:
        desc = int(request.GET.get('desc', 0))
    except ValueError:
        desc = 0
    desc_toggle = 0 if desc else 1

    threads_ = sort_threads(forum.thread_set, sort, desc)
    count = threads_.count()
    threads_ = threads_.select_related('creator', 'last_post',
                                       'last_post__author')
    threads_ = paginate(request, threads_,
                        per_page=constants.THREADS_PER_PAGE, count=count)

    feed_urls = ((reverse('forums.threads.feed', args=[forum_slug]),
                  ThreadsFeed().title(forum)),)

    is_watching_forum = (request.user.is_authenticated() and
                         NewThreadEvent.is_notifying(request.user, forum))
    return jingo.render(request, 'forums/threads.html',
                        {'forum': forum, 'threads': threads_,
                         'is_watching_forum': is_watching_forum,
                         'sort': sort, 'desc_toggle': desc_toggle,
                         'feeds': feed_urls})
开发者ID:Sancus,项目名称:kitsune,代码行数:36,代码来源:views.py

示例3: test_watch_forum

# 需要导入模块: from forums.events import NewThreadEvent [as 别名]
# 或者: from forums.events.NewThreadEvent import is_notifying [as 别名]
    def test_watch_forum(self):
        """Watch then unwatch a forum."""
        f = forum(save=True)
        forum_post(thread=thread(forum=f, save=True), save=True)
        u = user(save=True)

        self.client.login(username=u.username, password='testpass')

        post(self.client, 'forums.watch_forum', {'watch': 'yes'},
             args=[f.slug])
        assert NewThreadEvent.is_notifying(u, f)
        # NewPostEvent is not notifying.
        assert not NewPostEvent.is_notifying(u, f.last_post)

        post(self.client, 'forums.watch_forum', {'watch': 'no'},
             args=[f.slug])
        assert not NewThreadEvent.is_notifying(u, f)
开发者ID:Apokalyptica79,项目名称:kitsune,代码行数:19,代码来源:test_views.py

示例4: _toggle_watch_forum_as

# 需要导入模块: from forums.events import NewThreadEvent [as 别名]
# 或者: from forums.events.NewThreadEvent import is_notifying [as 别名]
 def _toggle_watch_forum_as(self, forum, user, turn_on=True):
     """Watch a forum and return it."""
     self.client.login(username=user.username, password='testpass')
     watch = 'yes' if turn_on else 'no'
     post(self.client, 'forums.watch_forum', {'watch': watch},
          args=[forum.slug])
     # Watch exists or not, depending on watch.
     if turn_on:
         assert NewThreadEvent.is_notifying(user, forum), (
                'NewThreadEvent should be notifying.')
     else:
         assert not NewPostEvent.is_notifying(user, forum), (
                'NewThreadEvent should not be notifying.')
开发者ID:Apokalyptica79,项目名称:kitsune,代码行数:15,代码来源:test_notifications.py

示例5: test_watch_thread

# 需要导入模块: from forums.events import NewThreadEvent [as 别名]
# 或者: from forums.events.NewThreadEvent import is_notifying [as 别名]
    def test_watch_thread(self):
        """Watch then unwatch a thread."""
        self.client.login(username='rrosario', password='testpass')
        user = User.objects.get(username='rrosario')

        t = Thread.objects.filter()[1]
        post(self.client, 'forums.watch_thread', {'watch': 'yes'},
             args=[t.forum.slug, t.id])
        assert NewPostEvent.is_notifying(user, t)
        # NewThreadEvent is not notifying.
        assert not NewThreadEvent.is_notifying(user, t.forum)

        post(self.client, 'forums.watch_thread', {'watch': 'no'},
             args=[t.forum.slug, t.id])
        assert not NewPostEvent.is_notifying(user, t)
开发者ID:Akamad007,项目名称:kitsune,代码行数:17,代码来源:test_views.py

示例6: test_watch_thread

# 需要导入模块: from forums.events import NewThreadEvent [as 别名]
# 或者: from forums.events.NewThreadEvent import is_notifying [as 别名]
    def test_watch_thread(self):
        """Watch then unwatch a thread."""
        t = thread(save=True)
        u = user(save=True)

        self.client.login(username=u.username, password='testpass')

        post(self.client, 'forums.watch_thread', {'watch': 'yes'},
             args=[t.forum.slug, t.id])
        assert NewPostEvent.is_notifying(u, t)
        # NewThreadEvent is not notifying.
        assert not NewThreadEvent.is_notifying(u, t.forum)

        post(self.client, 'forums.watch_thread', {'watch': 'no'},
             args=[t.forum.slug, t.id])
        assert not NewPostEvent.is_notifying(u, t)
开发者ID:Apokalyptica79,项目名称:kitsune,代码行数:18,代码来源:test_views.py

示例7: test_delete_removes_watches

# 需要导入模块: from forums.events import NewThreadEvent [as 别名]
# 或者: from forums.events.NewThreadEvent import is_notifying [as 别名]
 def test_delete_removes_watches(self):
     f = Forum.objects.get(pk=1)
     NewThreadEvent.notify('[email protected]', f)
     assert NewThreadEvent.is_notifying('[email protected]', f)
     f.delete()
     assert not NewThreadEvent.is_notifying('[email protected]', f)
开发者ID:AutomatedTester,项目名称:kitsune,代码行数:8,代码来源:test_models.py

示例8: test_delete_removes_watches

# 需要导入模块: from forums.events import NewThreadEvent [as 别名]
# 或者: from forums.events.NewThreadEvent import is_notifying [as 别名]
 def test_delete_removes_watches(self):
     f = forum(save=True)
     NewThreadEvent.notify('[email protected]', f)
     assert NewThreadEvent.is_notifying('[email protected]', f)
     f.delete()
     assert not NewThreadEvent.is_notifying('[email protected]', f)
开发者ID:Apokalyptica79,项目名称:kitsune,代码行数:8,代码来源:test_models.py


注:本文中的forums.events.NewThreadEvent.is_notifying方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。