Exemplo n.º 1
0
	def delete(self):
		page = Page.find(owner=self.user(), url=self.url())
		if page:
			page.delete()
			if not self.is_ajax():
				self.redirect('/')
		else:
			info("could not find page: %s" % (self.url(),))
			raise HttpError(404, "could not find saved page: %s" % (cgi.escape(self.url(),)))
Exemplo n.º 2
0
	def _add(self, user, url, success = None, force=False):
		new_page = None
		page = Page.find(user, url)
		if page is None:
			page = Page(owner=self.user(), url=url)
			page.start_content_population()
			new_page = page
		else:
			page.update(force=force)
			if force:
				new_page = page
		if page.errors:
			if not self.is_json():
				self._render_error(page)
		else:
			if success and new_page:
				success(new_page)
		return new_page
Exemplo n.º 3
0
	def get(self):
		page = Page.find(owner=self.user(), url=self.url())
		if page is None or page.content is None:
			raise HttpError(404, "could not find content for page: %s" % (cgi.escape(self.url(),)))
		self.response.out.write(page.content)