コード例 #1
0
ファイル: main.py プロジェクト: atbolsh/rcschess-google-app
	def post(self):
		storage_name = self.request.get('storage_name')
		desired = storage_key(storage_name)
		bases = Database.all().ancestor(desired)

		d = get_database(bases, self.request.get('base_name'), desired)
#		d.content = db.Text(sa.modify(str(d.content))) + db.Text(sa.modify(self.request.get('content')))

#		Running into problems with the alternate encoding schemes: if the string in the input already contains
#		exotic characters, then the textarea attribute fails miserably and dies, throwing a unicode error.
#		Even before we get to where I can affect the format in any way, askii is already assumed. Same with
#		reading data off: I cannot pass unicode in utf_16 to my functions; they need strings. For now, sticking
#		with askii.

#		print "Before"

		new = f.to_saveformat(self.request.get('content'))

#		print "After"

		d.content += db.Text(new)
#		d.content += db.Text(str(new[:-2]), encoding='utf_16') #The -1 at the end is to strip byte 0x0a, always at the end.
#		The one above are attempts at a happier world, where Russian characters are not prejudiced against. Too much work; focus on html encoding first, then
#		get around to non-askii standards of encoding.

#		print d.content 
		d.put()
#		print d.name + '</br>'
#		print d.content + '</br>'
#		bases = Database.all().ancestor(desired)
#		d = get_database(bases, self.request.get('name'), desired)
#		print d.name + '</br>'
#		print d.content + '</br>'

		self.redirect('/?' + urllib.urlencode({'storage_name': storage_name}))
コード例 #2
0
ファイル: main.py プロジェクト: atbolsh/rcschess-google-app
	def post(self):
#		print ""
		storage_name = self.request.get('storage_name')
		desired = storage_key(storage_name)
		bases = Database.all().ancestor(desired)

		d = get_database(bases, self.request.get('base_name'), desired)
		ind = int(self.request.get('index'))

		game = f.to_saveformat(self.request.get('game'), True)
		old = str(d.content)
		new = f.save_game(old, ind, game)

		d.content = db.Text(new)
		d.put()

		self.redirect('/?' + urllib.urlencode({'storage_name': storage_name}))