Wrong: filter(checkpoint_id=, bus.checkpoint_id)
Right:filter(checkpoint_id =, bus.checkpoint_id)
2009/4/22 风笑雪 kea...@gmail.com:
You mean this?
Wrong: filter(checkpoint_id=, bus.checkpoint_id)
Right:filter(checkpoint_id= , bus.checkpoint_id)
2009/4/22 Dmitry Kachaev
You mean this?
Wrong: filter(checkpoint_id=, bus.checkpoint_id)
Right:filter(checkpoint_id= , bus.checkpoint_id)
2009/4/22 Dmitry Kachaev dmitry.kach...@gmail.com
I got it, thanks all!
It was a lack of space between property name and operator in filter()
method. It led to empty result
Exactly.
Looking at exceptions reference I would expect BadQueryError or
BadArgumentError to be raised in wrong call.
Thanks again for helping me on this.
-Dmitry
On Apr 22, 7:26 am, 风笑雪 kea...@gmail.com wrote:
You mean this?
Wrong: filter(checkpoint_id=, bus.checkpoint_id)
Right:
Why you use models.Checkpoint?
Is the Checkpoint class defines in models package/module?
If not, use this:
point_old = Checkpoint.all().filter(checkpoint_id=,
bus.checkpoint_id).get()
And for the 'NoneType' object has no attribute 'checkpoint_id', you should
check bus.checkpoint_id to ensure
Hi Dmitry,
The issue here isn't with the query, but with your code that's calling
it. Python is throwing an exception because your variable 'bus' that
you're trying to fetch checkpoint_id on is set to None, not because
the result of the query is None. The query code never gets run.
-Nick
Apologies, my previous message was in error. Without more of your
source, it's hard to tell what's going wrong, though.
Also, this pattern:
db.GqlQuery(SELECT * FROM Checkpoint WHERE checkpoint_id = %s %
(bus.checkpoint_id))
is extremely dangerous. You should never, ever do string substitution
Yes, Checkpoint class is defined in models package.
bus.checkpoint_id has value (in both cases, I can see it in debug
messages)
-Dmitry
On Apr 21, 8:04 am, 风笑雪 kea...@gmail.com wrote:
Why you use models.Checkpoint?
Is the Checkpoint class defines in models package/module?
If not, use this:
I think your second one may be working because using the string
substitution is causing an unexpected value to appear in the query
that still is accepted by the engine. You should generate a log entry
before the query to see what passing the id to %s is actually giving
you.
On Apr 21, 8:10 am,
I got it, thanks all!
It was a lack of space between property name and operator in filter()
method. It led to empty result (but not an exception???)
-Dmitry
On Apr 21, 11:52 am, Mark Wolgemuth fuma...@gmail.com wrote:
I think your second one may be working because using the string