GAE python string equality - weird behavior using unicode

We are trying to compare strings, one is loaded from the data store, and the other is obtained from the HTML form using

modelID = self.request.get('fieldName')

Then we compare two:

result = db.Query(modelName).filter('model_id =', modelID).fetch(limit=1)

But despite the fact that I checked the data warehouse viewer and clearly see that the entity exists with model_id = modelID, python insists that they are not equal, rushing my attempt to get my application to work.

+3
source share
2 answers

Search for spaces in a string

you can use the string.strip () function to get rid of them! spaces are evil and will impede equality ...

take care of a man!

+2
source

unicode (modelID) .

, GAE unicodes.

+1

All Articles