“=” symbols in GAE TextProperty

2019-07-10 19:46发布

I'm getting strange additional symbols (=) in text property when adding text there via POST.
For example:
The team is back with an unstoppable fury as they are being chased by the p= olice, Alonzo and Yuuma. Vinnie, Shorty and Kiro=92s skills will be put to = the test.
There shouldn't be any of = symbols in that text. My co de is:

class FileUploadHandler(blobstore_handlers.BlobstoreUploadHandler):
def post(self):
    game_file = self.get_uploads()[1]
    screen_file = self.get_uploads()[0]

    if not users.get_current_user():
        game_file.delete()
        screen_file.delete()
        self.redirect(users.create_login_url("/"))
        return

    game = Game()
    game.title = self.request.get('title')
    game.url_name = self.request.get('url')
    if self.request.get('active') == 'active':
        game.active = True                                                                                                                                                      
    else:                                                                                                                                                                       
        game.active = False                                                                                                                                                     
    if self.request.get('featured') == 'featured':                                                                                                                              
        game.featured = True                                                                                                                                                    
    else:                                                                                                                                                                       
        game.featured = False                                                                                                                                                   
    query = Category.gql("WHERE url_name = :url_name", url_name=self.request.get('category'))                                                                                   
    game.category = query.get()                                                                                                                                                 
    game.width = int(self.request.get('width'))                                                                                                                                 
    game.height = int(self.request.get('height'))                                                                                                                               
    game.description = db.Text(self.request.get('desc'))
    game.how_to_play = db.Text(self.request.get('htp'))                                                                                                                         
    game.game_file = game_file                                                                                                                                                  
    game.game_screenshot = screen_file                                                                                                                                          

    db.put(game)

What am i doing wrong?

2条回答
Animai°情兽
2楼-- · 2019-07-10 20:12

I had the same difficulty. But, I found a fix. I'm using Python 2.5. In my model, I have a TextProperty, hooked up to an html TextArea tag. Like your situation, in the Dev server, it saved what I entered. However, in Prod, the DataStore somehow added "= " among others, every time I write the content of textarea over to the textproperty field.

Go here: http://code.google.com/p/googleappengine/issues/detail?id=2749

Then, scroll down to Comment 21. The poster of that comment attached a file, named appengine_config.py Download it, and put it on the root folder of your app. Then Deploy it to Prod and try it out in Prod.

I did that, and my "= " problem went away.

查看更多
成全新的幸福
3楼-- · 2019-07-10 20:15

This is a known issue of blobstore handler that is breaking the data encoding.

查看更多
登录 后发表回答