I am new with developing web applications with Google App Engine.
I wanted to check for entities in my datastore which have a null value set for a list property (db.ListProperty). However, when I tried to check anything against the entity.list GAE gives the error:
'super' object has no attribute 'list'.
After some search I saw in this SO question that setting an empty value for a list property of a GAE datastore entity is equivalent to not setting the property at all. This explains my error.
So I need to match entities in the datastore which do not have any list property set at all. Looking at the GAE documentation I still haven’t found any method which allows me to check whether an entity has a particular property set.
NOTE: I don’t have to do this with GQL. I can retrieve all entities with GQL, then check with python. But a GQL solution is also fine.
I can think of three ways around this.
You’re probably running into this situation because originally your model did not have a ‘list’ attribute, and you added one later, so you might have older instances in the datastore without the ‘list’ attribute. You can write a mapreduce function that goes through your datastore and ensures all entities have the ‘list’ element.
Otherwise, you can use the python hasattr function
Thirdly, you can use an exception handler to catch the error case.