“=” symbols in GAE TextProperty

青春壹個敷衍的年華 提交于 2020-01-04 05:40:08

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/5039813/symbols-in-gae-textproperty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!