示例#1
0
文件: Wiki.py 项目: arzh/CS253
	def post(self, page_name):
		#page_name = self.request.path
		page_name = string.replace(page_name, '/', '')
		p = Page.get_by("name", page_name+"page")
		content = self.request.get('content')
		ph = Page_History(content = content, parent = p)
		ph.put()

		re_page = '/%s' % page_name
		logging.info("redi to" + re_page)
		self.redirect(re_page)
示例#2
0
文件: Wiki.py 项目: arzh/CS253
	def get(self, page_name):
		page_name = string.replace(page_name, '/', '')
		logging.info("PageName: " + page_name)
		p = Page.get_by("name", page_name+"page")
		if p:
			ph = get_latest_ph(p)
			self.render("view.html", page_data = ph.content)
		else:
			if page_name == '':
				p = Page(name = page_name+"page")
				p.put()
				ph = Page_History(content = "THE FRONT PAGE!", parent = p)
				ph.put()

			if self.current_user:
				logging.info("Redirect!")
				self.redirect('/_edit/%s' % page_name)
			else:
				self.redirect('/')