示例#1
0
 def sitemap(self, dataset):
     self._get_dataset(dataset)
     pages = []
     for action in ['view', 'about']:
         pages.append({
             'loc':
             h.url_for(controller='dataset',
                       action=action,
                       dataset=c.dataset.name,
                       qualified=True),
             'lastmod':
             c.dataset.updated_at,
             'priority':
             0.8
         })
     for view in View.all_by_dataset(c.dataset):
         pages.append({
             'loc':
             h.url_for(controller='view',
                       action='view',
                       dataset=dataset,
                       name=view.name,
                       qualified=True),
             'lastmod':
             view.updated_at
         })
     return sitemap(pages)
示例#2
0
 def sitemap(self):
     sections = ['blog', 'resources', 'about', 'help']
     base = h.url_for(controller='home', action='index', qualified=True)
     pages = []
     for section in sections:
         pages.append({
             'loc': base + section + '/index.html',
             'lastmod': datetime.utcnow(),
             'freq': 'daily',
             'priority': 0.9
             })
     return sitemap(pages)
示例#3
0
 def sitemap(self, dataset, dimension):
     self._get_dimension(dataset, dimension)
     etag_cache_keygen(c.dataset.updated_at, 'xml')
     pages = []
     # TODO: Make this work for dimensions with more than 30,000 members.
     for member in c.dimension.members(limit=30000):
         pages.append({
             'loc': url_for(controller='dimension', action='member',
                 dataset=dataset, dimension=dimension, name=member.get('name'),
                 qualified=True),
             'lastmod': c.dataset.updated_at
             })
     return sitemap(pages)
示例#4
0
 def sitemap(self, dataset, page):
     self._get_dataset(dataset)
     etag_cache_keygen(c.dataset.updated_at, "xml")
     limit = 30000
     pages = []
     for entry in c.dataset.entries(limit=limit, offset=(int(page) - 1) * limit, step=limit, fields=[]):
         pages.append(
             {
                 "loc": h.url_for(
                     controller="entry", action="view", dataset=dataset, id=entry.get("id"), qualified=True
                 ),
                 "lastmod": c.dataset.updated_at,
             }
         )
     return sitemap(pages)
示例#5
0
 def sitemap(self, dataset, page):
     self._get_dataset(dataset)
     etag_cache_keygen(c.dataset.updated_at, 'xml')
     limit = 30000
     pages = []
     for entry in c.dataset.entries(limit=limit,
                                    offset=(int(page) - 1) * limit,
                                    step=limit, fields=[]):
         pages.append({
             'loc': h.url_for(controller='entry', action='view',
                              dataset=dataset, id=entry.get('id'),
                              qualified=True),
             'lastmod': c.dataset.updated_at
             })
     return sitemap(pages)
示例#6
0
 def sitemap(self, dataset):
     self._get_dataset(dataset)
     pages = []
     for action in ['view', 'about']:
         pages.append({
             'loc': h.url_for(controller='dataset', action=action,
                              dataset=c.dataset.name, qualified=True),
             'lastmod': c.dataset.updated_at,
             'priority': 0.8})
     for view in View.all_by_dataset(c.dataset):
         pages.append({
             'loc': h.url_for(controller='view', action='view',
                              dataset=dataset, name=view.name,
                              qualified=True),
             'lastmod': view.updated_at
             })
     return sitemap(pages)
示例#7
0
 def sitemap(self, dataset, dimension):
     self._get_dimension(dataset, dimension)
     etag_cache_keygen(c.dataset.updated_at, 'xml')
     pages = []
     # TODO: Make this work for dimensions with more than 30,000 members.
     for member in c.dimension.members(limit=30000):
         pages.append({
             'loc':
             url_for(controller='dimension',
                     action='member',
                     dataset=dataset,
                     dimension=dimension,
                     name=member.get('name'),
                     qualified=True),
             'lastmod':
             c.dataset.updated_at
         })
     return sitemap(pages)
示例#8
0
 def sitemap(self, dataset):
     self._get_dataset(dataset)
     pages = []
     for action in ["view", "about"]:
         pages.append(
             {
                 "loc": h.url_for(controller="dataset", action=action, dataset=c.dataset.name, qualified=True),
                 "lastmod": c.dataset.updated_at,
                 "priority": 0.8,
             }
         )
     for view in View.all_by_dataset(c.dataset):
         pages.append(
             {
                 "loc": h.url_for(controller="view", action="view", dataset=dataset, name=view.name, qualified=True),
                 "lastmod": view.updated_at,
             }
         )
     return sitemap(pages)
示例#9
0
 def sitemap(self, dataset, page):
     self._get_dataset(dataset)
     etag_cache_keygen(c.dataset.updated_at, 'xml')
     limit = 30000
     pages = []
     for entry in c.dataset.entries(limit=limit,
                                    offset=(int(page) - 1) * limit,
                                    step=limit,
                                    fields=[]):
         pages.append({
             'loc':
             h.url_for(controller='entry',
                       action='view',
                       dataset=dataset,
                       id=entry.get('id'),
                       qualified=True),
             'lastmod':
             c.dataset.updated_at
         })
     return sitemap(pages)
示例#10
0
 def sitemap(self, dataset, dimension):
     self._get_dimension(dataset, dimension)
     etag_cache_keygen(c.dataset.updated_at, "xml")
     pages = []
     # TODO: Make this work for dimensions with more than 30,000 members.
     for member in c.dimension.members(limit=30000):
         pages.append(
             {
                 "loc": url_for(
                     controller="dimension",
                     action="member",
                     dataset=dataset,
                     dimension=dimension,
                     name=member.get("name"),
                     qualified=True,
                 ),
                 "lastmod": c.dataset.updated_at,
             }
         )
     return sitemap(pages)