开发者

"=" symbols in GAE TextProperty

开发者 https://www.devze.com 2023-02-12 01:48 出处:网络
I\'m getting strange additional symbols (=) in text property when adding text there via POST. For example:

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?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号