本文整理汇总了Python中askbot.models.Post._thread_cache方法的典型用法代码示例。如果您正苦于以下问题:Python Post._thread_cache方法的具体用法?Python Post._thread_cache怎么用?Python Post._thread_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类askbot.models.Post
的用法示例。
在下文中一共展示了Post._thread_cache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cached_get_absolute_url_1
# 需要导入模块: from askbot.models import Post [as 别名]
# 或者: from askbot.models.Post import _thread_cache [as 别名]
def test_cached_get_absolute_url_1(self):
th = lambda:1
th.title = 'lala-x-lala'
p = Post(id=3, post_type='question')
p._thread_cache = th # cannot assign non-Thread instance directly
self.assertEqual('/question/3/lala-x-lala/', p.get_absolute_url(thread=th))
self.assertTrue(p._thread_cache is th)
self.assertEqual('/question/3/lala-x-lala/', p.get_absolute_url(thread=th))
示例2: test_cached_get_absolute_url_1
# 需要导入模块: from askbot.models import Post [as 别名]
# 或者: from askbot.models.Post import _thread_cache [as 别名]
def test_cached_get_absolute_url_1(self):
th = lambda: 1
th.title = "lala-x-lala"
p = Post(id=3, post_type="question")
p._thread_cache = th # cannot assign non-Thread instance directly
expected_url = urlresolvers.reverse("question", kwargs={"id": 3}) + th.title + "/"
self.assertEqual(expected_url, p.get_absolute_url(thread=th))
self.assertTrue(p._thread_cache is th)
self.assertEqual(expected_url, p.get_absolute_url(thread=th))
示例3: test_cached_get_absolute_url_1
# 需要导入模块: from askbot.models import Post [as 别名]
# 或者: from askbot.models.Post import _thread_cache [as 别名]
def test_cached_get_absolute_url_1(self):
th = lambda:1
th.title = 'lala-x-lala'
p = Post(id=3, post_type='question')
p._thread_cache = th # cannot assign non-Thread instance directly
expected_url = urlresolvers.reverse('question', kwargs={'id': 3}) \
+ th.title + '/'
self.assertEqual(expected_url, p.get_absolute_url(thread=th))
self.assertTrue(p._thread_cache is th)
self.assertEqual(expected_url, p.get_absolute_url(thread=th))