def post(self): new_charset = CharacterSet( name = self.request.get("name") ) new_charset.save() self.redirect("/admin/%s/" % new_charset.key())
def get(self,charset_key): charset = CharacterSet.get(charset_key) characters = CharacterSet.get(charset_key) template_vars = { "characters":characters, "upload_url":blobstore.create_upload_url('/admin/%s/upload/do/' % charset_key) } self.response.out.write(template.render(get_template_path("admin_upload"), template_vars))
def get(self,charset_key): text = self.request.get("text") charset = CharacterSet.get(charset_key) images = [] if text: for character in text: logging.info(character) the_character = character.upper() character_images_query = Character.all() character_images_query.filter("character = ", the_character) characters = character_images_query.fetch(1000) if characters: images.append(choice(characters).image_url) template_vars = { "charset":charset, "text":text, "images":images, } self.response.out.write(template.render(get_template_path("charset"), template_vars))
def get(self,charset_key): charset = CharacterSet.get(charset_key) characters = get_characters(charset) template_vars = { "charset":charset, "characters":characters, } self.response.out.write(template.render(get_template_path("admin_charset"), template_vars))
def post(self,charset_key): character_set = CharacterSet.get(charset_key) logging.info(character_set) upload_files = self.get_uploads('file') blob_info = upload_files[0] new_character = Character( character = self.request.get("character").upper(), character_set = character_set, image_blob = blob_info.key(), image_url = get_serving_url(blob_info.key()), ) new_character.save() self.redirect("/admin/%s/" % charset_key)
def get_character_sets(): character_sets_query = CharacterSet.all() return character_sets_query.fetch(1000)