예제 #1
0
  def get(self):
    self.acl.check_edit_settings()

    for page in WikiContent.all().fetch(1000):
      if page.updated is None or page.author is None or page.body is None:
        rev = WikiRevision.gql('WHERE wiki_page = :1 ORDER BY version_number DESC', page).get()
        if rev is not None:
          page.updated = rev.created
          page.author = rev.author
          page.pread = rev.pread
          page.body = rev.revision_body
          page.put()
      elif '_' in page.title:
        page.title = page.title.replace('_', ' ')
        page.put()

    self.redirect('/w/index')
예제 #2
0
  def get(self):
    content = memcache.get('/sitemap.xml')
    if True or not content:
      content = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
      content += "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n"

      settings = self.settings
      host = self.request.environ['HTTP_HOST']

      for page in WikiContent.all().fetch(1000):
        if settings.data.pread or page.pread:
          line = "<url><loc>http://%s/%s</loc>" % (host, pages.quote(page.title))
          if page.updated:
            line += "<lastmod>%s</lastmod>" % (page.updated.strftime('%Y-%m-%d'))
          line += "</url>\n"
          content += line
      content += "</urlset>\n"

      memcache.set('/sitemap.xml', content)

    self.response.headers['Content-Type'] = 'text/xml'
    self.response.out.write(content)