Help With Error: ReferenceProperty failed to be resolved

26 views
Skip to first unread message

Kambiz Kambiz

unread,
Aug 27, 2009, 4:29:30 PM8/27/09
to Google App Engine
I recently ignorantly deleted an entity of mine thru the Dashboard.

Now when only my user accesses a certain section of the app, I recieve
this error:

Traceback (most recent call last):
File "/base/python_lib/versions/1/google/appengine/ext/webapp/
__init__.py", line 507, in __call__
handler.get(*groups)
File "/base/data/home/apps/appname/1.333395169432469460/
quizlink.py", line 757, in get
selectors = [selector for selector in self.get_selectors(user) if
selector.quiz.question_count > 0]
File "/base/python_lib/versions/1/google/appengine/ext/db/
__init__.py", line 2704, in __get__
raise Error('ReferenceProperty failed to be resolved')
Error: ReferenceProperty failed to be resolved

Only my username creates this problem, not other's. I'd like to fix
this, but I can't think of anyway around it. I tried to manually
recreate the entity thru the Dashboard, with the same ID (112052) but
that doesnt work as the ID is randomly generated and cannot be edited.
Anyone have any ideas?

Thanks,

Kambiz

djidjadji

unread,
Aug 27, 2009, 4:47:26 PM8/27/09
to google-a...@googlegroups.com
With a query find all the objects that have this faulty reference property.
Create a new property of the correct type and update the objects of the query

You can get rid of the list comprehention, make it a for loop that
fills a list, catch the exception and filter out the objects with the
rogue reference

selectors = []
for selector in self.get_selectors(user):
try:
if selector.quiz.question_count > 0:
selectors.append(selector)
except Error
pass # or update the reference and put() the selector back

2009/8/27 Kambiz Kambiz <kam...@gmail.com>:

Kambiz Kambiz

unread,
Aug 27, 2009, 9:39:09 PM8/27/09
to Google App Engine
I can't write a query to find all the objects with this reference
property since I deleted one object which caused this problem.
That object is now gone.

That being said, I don't know if your method will work since all my
object right now are technically OK but since 1 is missing in the
list, it isn't generating it. Does that make sense?

Kambiz

djidjadji

unread,
Aug 28, 2009, 4:23:35 AM8/28/09
to google-a...@googlegroups.com
Yes you can find all of them.
You know the ID of the deleted object (112052).
The Key of this object is

rogueKey = db.Key.from_path('Quiz',112052)

or is there a parent object of a Quiz object? If so put that in the path too.

Find all the faulty references

result = Selector.all().filter('quiz =', rogueKey).fetch(1000)

Or use a method like the Mapper class in the remote_api article if
there are a lot of those objects.


2009/8/28 Kambiz Kambiz <kam...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages