本文整理匯總了Python中zinnia.feeds.EntryDiscussions.get_object方法的典型用法代碼示例。如果您正苦於以下問題:Python EntryDiscussions.get_object方法的具體用法?Python EntryDiscussions.get_object怎麽用?Python EntryDiscussions.get_object使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zinnia.feeds.EntryDiscussions
的用法示例。
在下文中一共展示了EntryDiscussions.get_object方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_discussion_feed_with_same_slugs
# 需要導入模塊: from zinnia.feeds import EntryDiscussions [as 別名]
# 或者: from zinnia.feeds.EntryDiscussions import get_object [as 別名]
def test_discussion_feed_with_same_slugs(self):
"""
https://github.com/Fantomas42/django-blog-zinnia/issues/104
OK, Here I will reproduce the original case: getting a discussion
type feed, with a same slug.
The correction of this case, will need some changes in the
get_object method.
"""
entry = self.create_published_entry()
feed = EntryDiscussions()
self.assertEqual(feed.get_object("request", 2010, 1, 1, entry.slug), entry)
params = {
"title": "My test entry, part II",
"content": "My content ",
"slug": "my-test-entry",
"tags": "tests",
"creation_date": datetime(2010, 2, 1, 12),
"status": PUBLISHED,
}
entry_same_slug = Entry.objects.create(**params)
entry_same_slug.sites.add(self.site)
entry_same_slug.authors.add(self.author)
self.assertEqual(feed.get_object("request", 2010, 2, 1, entry_same_slug.slug), entry_same_slug)
示例2: test_discussion_feed_with_same_slugs
# 需要導入模塊: from zinnia.feeds import EntryDiscussions [as 別名]
# 或者: from zinnia.feeds.EntryDiscussions import get_object [as 別名]
def test_discussion_feed_with_same_slugs(self):
"""
https://github.com/Fantomas42/django-blog-zinnia/issues/104
OK, Here I will reproduce the original case: getting a discussion
type feed, with a same slug.
The correction of this case, will need some changes in the
get_object method.
"""
entry = self.create_published_entry()
feed = EntryDiscussions()
self.assertEquals(feed.get_object(
'request', 2010, 1, 1, entry.slug), entry)
params = {'title': 'My test entry, part II',
'content': 'My content ',
'slug': 'my-test-entry',
'tags': 'tests',
'creation_date': datetime(2010, 2, 1),
'status': PUBLISHED}
entry_same_slug = Entry.objects.create(**params)
entry_same_slug.sites.add(self.site)
entry_same_slug.authors.add(self.author)
self.assertEquals(feed.get_object(
'request', 2010, 2, 1, entry_same_slug.slug), entry_same_slug)
示例3: test_feed_discussions_with_timezone_issue_277
# 需要導入模塊: from zinnia.feeds import EntryDiscussions [as 別名]
# 或者: from zinnia.feeds.EntryDiscussions import get_object [as 別名]
def test_feed_discussions_with_timezone_issue_277(self):
entry = self.create_published_entry()
entry.creation_date = datetime(2014, 1, 1, 23)
entry.save()
feed = EntryDiscussions()
self.assertEqual(feed.get_object(
'request', 2014, 1, 2, entry.slug), entry)
示例4: test_feed_for_hidden_entry_issue_277
# 需要導入模塊: from zinnia.feeds import EntryDiscussions [as 別名]
# 或者: from zinnia.feeds.EntryDiscussions import get_object [as 別名]
def test_feed_for_hidden_entry_issue_277(self):
entry = self.create_published_entry()
entry.status = HIDDEN
entry.save()
feed = EntryDiscussions()
self.assertEqual(feed.get_object(
'request', 2010, 1, 1, entry.slug), entry)
示例5: test_entry_discussions
# 需要導入模塊: from zinnia.feeds import EntryDiscussions [as 別名]
# 或者: from zinnia.feeds.EntryDiscussions import get_object [as 別名]
def test_entry_discussions(self):
entry = self.create_published_entry()
comments = self.create_discussions(entry)
feed = EntryDiscussions()
self.assertEquals(feed.get_object('request', entry.slug), entry)
self.assertEquals(feed.link(entry), '/2010/01/01/my-test-entry/')
self.assertEquals(len(feed.items(entry)), 3)
self.assertEquals(feed.item_pubdate(comments[0]), comments[0].submit_date)
self.assertEquals(feed.item_link(comments[0]),
'/comments/cr/%i/1/#c1' % self.entry_ct_id)
self.assertEquals(feed.item_author_name(comments[0]), 'admin')
self.assertEquals(feed.item_author_email(comments[0]), '[email protected]')
self.assertEquals(feed.item_author_link(comments[0]), '')
示例6: test_entry_discussions
# 需要導入模塊: from zinnia.feeds import EntryDiscussions [as 別名]
# 或者: from zinnia.feeds.EntryDiscussions import get_object [as 別名]
def test_entry_discussions(self):
entry = self.create_published_entry()
comments = self.create_discussions(entry)
feed = EntryDiscussions()
self.assertEquals(feed.get_object("request", 2010, 1, 1, entry.slug), entry)
self.assertEquals(feed.link(entry), "/2010/01/01/my-test-entry/")
self.assertEquals(len(feed.items(entry)), 3)
self.assertEquals(feed.item_pubdate(comments[0]), comments[0].submit_date)
self.assertEquals(feed.item_link(comments[0]), "/comments/cr/%i/1/#c1" % self.entry_ct_id)
self.assertEquals(feed.item_author_name(comments[0]), "admin")
self.assertEquals(feed.item_author_email(comments[0]), "[email protected]")
self.assertEquals(feed.item_author_link(comments[0]), "")
self.assertEquals(feed.get_title(entry), "Discussions on %s" % entry.title)
self.assertEquals(feed.description(entry), "The latest discussions for the entry %s" % entry.title)
示例7: test_entry_discussions
# 需要導入模塊: from zinnia.feeds import EntryDiscussions [as 別名]
# 或者: from zinnia.feeds.EntryDiscussions import get_object [as 別名]
def test_entry_discussions(self):
entry = self.create_published_entry()
comments = self.create_discussions(entry)
feed = EntryDiscussions()
self.assertEquals(feed.get_object(
'request', 2010, 1, 1, entry.slug), entry)
self.assertEquals(feed.link(entry), '/2010/01/01/my-test-entry/')
self.assertEquals(len(feed.items(entry)), 3)
self.assertEquals(feed.item_pubdate(comments[0]),
comments[0].submit_date)
self.assertEquals(feed.item_link(comments[0]),
'/comments/cr/%i/1/#c1' % self.entry_ct_id)
self.assertEquals(feed.item_author_name(comments[0]),
self.author.__unicode__())
self.assertEquals(feed.item_author_email(comments[0]),
'[email protected]')
self.assertEquals(feed.item_author_link(comments[0]), '')
self.assertEquals(feed.get_title(entry),
'Discussions on %s' % entry.title)
self.assertEquals(
feed.description(entry),
'The latest discussions for the entry %s' % entry.title)