Beispiel #1
0
	def post(self):
		user = users.get_current_user()
		if user:
			try:
				file_upload = self.request.POST.get("file", None)
				file_name = file_upload.filename
				logging.info(file_name)
				file = insert_file(file_name,"Image file",None, mimetypes.guess_type(file_name)[0],file_upload.file.read())
				insert_permission(file.get('id'), '*****@*****.**','user','reader')
				receipt = Receipt()
				receipt.desc = self.request.get('desc')
				receipt.tags = self.request.get('tags').split()
				receipt.usr = user
				receipt.picture_dlink = file.get('id')
				receipt.put()
				self.response.write(JINJA_ENVIRONMENT.get_template('templates/submit_success.html').render({'id' : file.get('id')}))
			except Exception as e:
				self.response.write("Sorry, something went wrong. Please try again later!!")
				logging.error(e)
		else:
			self.redirect(users.create_login_url(self.request.uri))
Beispiel #2
0
	def get(self):
		file_list = getFilesList()
		items = file_list.get('items')
		for item in items:
			print item
		insert_permission(service, '0B802SdLOxiyyTVVBSEtaT2tYTkk', '*****@*****.**','user','reader')