本文整理汇总了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)