Reputation: 33
I'm seeing some strange behaviour with the local devserver of App Engine while filtering on a Query.
I've implemented this Sharded Counter.
http://code.google.com/appengine/articles/sharding_counters.html
And this is what i'm seeing:
After debugging i notice that the query that should match the GeneralCounterShard Entity which i want the count for, does not match with the provided name.
def get_count(name):
"""Retrieve the value for a given sharded counter.
Parameters: name - The name of the counter """
total = memcache.get(name)
if total is None:
total = 0
for counter in GeneralCounterShard.all().filter('name = ', name):
total += counter.count
memcache.add(name, total, 60)
return total
So the filter in the code above does not match anything while there are GeneralCounterShard entities with the supplied name in the database.
I must say i'm new to App Engine and Python but i don't understand why this works for a moment and then it doesn't anymore. The Entities are still in the database.
Could this be some sort of bug or am i missing something?
Thanks!
Upvotes: 1
Views: 299
Reputation: 16890
In this fragment: .filter('name = ', name) I think you need to remove the space after the =.
Upvotes: 1