Ejemplo n.º 1
0
	def post(self):
		documentName = Document.newname()
		htmlcontent = constants.HTML_DEFAULT
		csscontent = constants.CSS_DEFAULT

		documents = Document(parent=Document.getkey(documentName))		
		documents.htmlcontent = htmlcontent
		documents.csscontent = csscontent
		documents.documentName = documentName
		documents.name = constants.DEFAULT_NAME
		documents.key = Document.getkey(documentName)
		documents.put()
		
		query_params = {'documentName':documentName}
		self.redirect('/edit?' + urllib.urlencode(query_params))		
Ejemplo n.º 2
0
	def post(self):
		self.response.write('<html><body>')
		htmlcontent = self.request.get('htmlcontent')
		csscontent = self.request.get('csscontent')	
		documentName = self.request.get('documentName')
		humanname = self.request.get('humanname')
		
		documents_query = Document.query(ancestor=Document.getkey(documentName))
		document = documents_query.fetch()[0]
		
		document.htmlcontent = htmlcontent
		document.csscontent = csscontent
		document.name = humanname

		document.put()
Ejemplo n.º 3
0
	def get(self):
		documentName = self.request.get('documentName')
		documents_query = Document.query(ancestor=Document.getkey(documentName))
		
		document = documents_query.fetch()
		if len(document) == 0:
			self.response.write(TEMPLATE_404.render({}))
			return

		document = document[0]
		template = JINJA_ENVIRONMENT.get_template('editor.html')
		self.response.write(template.render({
			'htmlcontent' : document.htmlcontent,
			'csscontent' : document.csscontent,
			'humanname' : document.name,
			'id' : documentName,
			'title' : 'Editing ' + document.name
		}))
Ejemplo n.º 4
0
	def get(self):		
		htmlcontent = self.request.get('htmlcontent')
		csscontent = self.request.get('csscontent')	
		documentName = self.request.get('documentName')
		
		documents_query = Document.query(ancestor=Document.getkey(documentName))
		document = documents_query.fetch()

		if len(document) == 0:
			self.response.write(TEMPLATE_404.render({}))
			return

		document = document[0]
		template = JINJA_ENVIRONMENT.get_template('view.html')
		self.response.write(template.render({
			'htmlcontent' : document.htmlcontent,
			'csscontent' : document.csscontent,
			'editurl' : '/edit?' + urllib.urlencode({'documentName' : documentName}),
			'title' : document.name,
			'id' : documentName
		}))