def get(self):
		postData = self.request.get('post')
		if(postData):
			postToEdit = int(postData)
			#self.response.out.write(postToEdit)
			post = db.GqlQuery("SELECT * FROM BlogPost WHERE post_id=:1",postToEdit)
			for pos in post:
				galleryCode = gallery.Gallery()
				galleryCode.constructGallery(pos.post_id,False,True)
				published = ""
				unpublished = ""
				if(pos.published):
					published = "Published"
					unpublished = ""
				else:
					published = ""
					unpublished = "Not Published"
				imageUrls = common.getImageURLs(pos.post_id)
				self.response.out.write(template.render('edit.html',{'imageURLs':imageUrls,'published':published,'unpublished':unpublished,'postNumber' : pos.post_id, 'title' : pos.title, 'content' : pos.content ,'gallery_code' : galleryCode.render(), 'renderedcontent' : textile.textile(pos.content)}))

		else:
			posts = db.GqlQuery("SELECT * FROM BlogPost ORDER BY post_id")
			for post in posts:
				self.response.out.write("Post %s: %s <a href=\"/edit?post=%s\">edit</a><br/>" % (post.post_id, post.title, post.post_id))
	def get(self,post):
		post_id = int(post)
		imageURLCode = common.getImageURLs(post_id)
		self.response.out.write(imageURLCode)