本文整理匯總了Python中django.contrib.sitemaps.Sitemap.get_urls方法的典型用法代碼示例。如果您正苦於以下問題:Python Sitemap.get_urls方法的具體用法?Python Sitemap.get_urls怎麽用?Python Sitemap.get_urls使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.contrib.sitemaps.Sitemap
的用法示例。
在下文中一共展示了Sitemap.get_urls方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_urls
# 需要導入模塊: from django.contrib.sitemaps import Sitemap [as 別名]
# 或者: from django.contrib.sitemaps.Sitemap import get_urls [as 別名]
def get_urls(self, page=1, site=None, protocol=None):
"""
This method is overridden so the appropriate `geo_format` attribute
is placed on each URL element.
"""
urls = Sitemap.get_urls(self, page=page, site=site, protocol=protocol)
for url in urls:
url['geo_format'] = self.geo_format
return urls
示例2: get_urls
# 需要導入模塊: from django.contrib.sitemaps import Sitemap [as 別名]
# 或者: from django.contrib.sitemaps.Sitemap import get_urls [as 別名]
def get_urls(self, page=1, site=None, protocol=None):
"""
This method is overrridden so the appropriate `geo_format` attribute
is placed on each URL element.
"""
urls = Sitemap.get_urls(self, page=page, site=site, protocol=protocol)
for url in urls:
url['geo_format'] = self.geo_format
return urls
示例3: get_urls
# 需要導入模塊: from django.contrib.sitemaps import Sitemap [as 別名]
# 或者: from django.contrib.sitemaps.Sitemap import get_urls [as 別名]
def get_urls(self, page=1, site=None):
"""
This method is overrridden so the appropriate `geo_format` attribute
is placed on each URL element.
"""
urls = Sitemap.get_urls(self, page=page, site=site)
for url in urls: url['geo_format'] = 'georss'
return urls
示例4: get_urls
# 需要導入模塊: from django.contrib.sitemaps import Sitemap [as 別名]
# 或者: from django.contrib.sitemaps.Sitemap import get_urls [as 別名]
def get_urls(self, page=1, site=None):
"""
This method is overrridden so the appropriate `geo_format` attribute
is placed on each URL element.
"""
urls = Sitemap.get_urls(self, page=page, site=site)
for url in urls: url['geo_format'] = self.geo_format
return urls
示例5: test_sitemap_get_urls_no_site_1
# 需要導入模塊: from django.contrib.sitemaps import Sitemap [as 別名]
# 或者: from django.contrib.sitemaps.Sitemap import get_urls [as 別名]
def test_sitemap_get_urls_no_site_1(self):
"""
Check we get ImproperlyConfigured if we don't pass a site object to
Sitemap.get_urls and no Site objects exist
"""
Site.objects.all().delete()
self.assertRaises(ImproperlyConfigured, Sitemap().get_urls)
示例6: test_sitemap_get_urls_no_site_2
# 需要導入模塊: from django.contrib.sitemaps import Sitemap [as 別名]
# 或者: from django.contrib.sitemaps.Sitemap import get_urls [as 別名]
def test_sitemap_get_urls_no_site_2(self):
"""
Check we get ImproperlyConfigured when we don't pass a site object to
Sitemap.get_urls if Site objects exists, but the sites framework is not
actually installed.
"""
Site._meta.installed = False
self.assertRaises(ImproperlyConfigured, Sitemap().get_urls)
示例7: test_sitemap_item
# 需要導入模塊: from django.contrib.sitemaps import Sitemap [as 別名]
# 或者: from django.contrib.sitemaps.Sitemap import get_urls [as 別名]
def test_sitemap_item(self):
"""
Check to make sure that the raw item is included with each
Sitemap.get_url() url result.
"""
test_sitemap = GenericSitemap({'queryset': TestModel.objects.all()})
def is_testmodel(url):
return isinstance(url['item'], TestModel)
item_in_url_info = all(map(is_testmodel, test_sitemap.get_urls()))
self.assertTrue(item_in_url_info)