示例#1
0
	def get(self):
		urls = []
		host = 'http://blog-pj.appspot.com'

		urls.append(Url(host + '/archive', 'monthly', '1.00')) 
		urls.append(Url(host + '/guestbook', 'monthly', '1.00')) 
		urls.append(Url(host + '/about', 'monthly', '1.00')) 
		urls.append(Url(host + '/feed', 'monthly', '1.00')) 

		cats = Category.all()
		for cat in cats:
			urls.append(Url(host + '/category/' + cat.name, 'monthly', '0.8'))
		urls.append(Url(host + '/category/unsorted', 'monthly', '0.8'))

		tags = Tag.all()
		for tag in tags:
			urls.append(Url(host + '/tag/' + tag.name, 'monthly', '0.8'))

		arcs = Archive.all()
		for arc in arcs:
			urls.append(Url(host + '/date/' + str(arc.year) + \
				                   '/' + str(arc.month), 'monthly', '0.8'))

		arts = Article.all()
		for art in arts:
			urls.append(Url(host + '/article/' + art.permalink, 'monthly', '0.6'))

		template_values = {
			'urls': urls
		}

		path = os.path.join(os.path.dirname(__file__), 'sitemap.xml')
		self.response.out.write(template.render(path, template_values))
示例#2
0
	def get(self):
		archives = Archive.all().order('-year').order('-month').fetch(1000)

		template_values = {
			'pagename': 'archive',
			'archives': archives,
			'tags': get_all_tags(),
			'categories': get_all_categories(),
			'unsorted_count': count_unsorted(),
		}

		path = os.path.join(os.path.dirname(__file__), 'pages/archive.html')
		self.response.out.write(template.render(path, template_values))