Google app engine : get_by_id not reliable?
I have a very simple query by get_by_id
:
query = Query().get_by_id(int(sel开发者_Python百科f.request.get('id')))
The int(self.request.get('id')) have no problem passing the value.
My problem is that sometime the query work and sometime aren't. When it was not working it show AttributeError: 'Query' object has no attribute 'abc'
Any idea?
You're constructing a new instance of your entity class (Query
is a poor name for it, by the way), then calling a class method on it. You don't need to do this - just call the class method directly:
query = Query.get_by_id(int(self.request.get('id')))
In the google.appengine.ext.db
there is a class called Query (which doesn't have an abc
attribute). You might want to change the name of your model, just in case the reference is being resolved incorrectly.
精彩评论