Please help me to understand Why this error on App Engine (Python 2.5, High Replication) ?
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 703, in __call__
handler.post(*groups)
File "/base/data/home/apps/s~apptest/1.354937136776013205/main.py", line 963, in post
get_purchases_for_user(pur.user, pur.car.model)
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 3592, in __get__
reference_id.to_path())
ReferencePropertyResolveError: ReferenceProperty failed to be resolved: [u'User', 374836L]
Context: The application is about recommendations to buy cars.
When this happens: Around 2 times per each 100 transactions approximately, so really I don't know when nor why.
Where the object pur in the code is defined as:
allPurchases = models.Purchase.all()
for pur in allPurchases:
car = get_purchases_for_user(pur.user, pur.car.model)
Also I put this code before and I got the same error, of course referencing to this line
logging.error("Object user: %s, Car Model %s" % {str(pur.user), pur.car.model})
So, the problem is not in the get_purchases_for_user function
And these are the models in the datastore:
class User(db.Model):
username = db.StringProperty(
required=True)
name = db.StringProperty(
required=True)
email = db.EmailProperty(
required=True)
password = db.StringProperty(
required=True)
class Car(db.Model):
model = db.StringProperty()
name = db.StringProperty()
year = db.DateTimeProperty()
class Purchase(db.Model):
user = db.ReferenceProperty(User,
collection_name='recommendations')
car = db.ReferenceProperty(Car,
collection_name='recommendations')
when = db.DateTimeProperty(
auto_now=True)
Userentity with the ID374836? - Wooble