2 messages in com.googlegroups.google-appengine[google-appengine] ReferenceProperty ...| From | Sent On | Attachments |
|---|---|---|
| codingJoe | 30 Jul 2008 21:03 | |
| Jorge Vargas | 30 Jul 2008 21:11 |
| Subject: | [google-appengine] ReferenceProperty failed to be resolved; corrupt data problem?![]() |
|---|---|
| From: | codingJoe (codi...@gmail.com) |
| Date: | 07/30/2008 09:03:31 PM |
| List: | com.googlegroups.google-appengine |
I have 2 classes Foo and Bar. A Foo has n Bars. All Bars should be owned by a Foo.
I deleted some Foos (foo.delete()), but not the Bars. When I run my code, I get a 'ReferenceProperty failed to be resolved' Error.
1. How do I fix this if I have a corrupt database?
2. What is the proper way to delete my Foo objects to prevent this problem.
-----------python---------
class Foo(db.Model): fooText = db.StringProperty(required=True, default="I am Foo") createdBy = db.UserProperty(required=False) fooData = db.StringProperty(required=False, default="I am Foo StringProperty") fooDesc = db.TextProperty(required=False) # Large description 'Story' about Foo
class Bar(db.Model): name = db.StringProperty(required=True) fooRef = db.ReferenceProperty(reference_class=Foo)
@staticmethod def get_all_bars(): bars=db.Query(Bar) if _MODEL_DEBUG: print >> sys.stdout, "(" + _MVER + ") Getting all bars." return bars
class ListBars(BaseRequestHandler): def get(self): barList = Bar.get_all_bars() barList = list(barList) logging.debug('Listing all Bars') logging.debug('Bar Count=' + str(len(barList))) self.generate('barlist.html', { 'barList': barList }) -----------end python---------
-----------html----------- <h2> BarList </h2> <ul> {% for bar in barList %} <li>{{ bar.name }} || {{ bar.fooRef.key }} </li> {% endfor %} </ul> -----------end html-----------
------------error------------- Traceback (most recent call last): File "/cygdrive/c/Program Files/Google/google_appengine/google/ appengine/ext/webapp/__init__.py", line 499, in __call__ handler.get(*groups) File "/cygdrive/e/decm/test1.py", line 142, in get 'page': 'foo' File "/cygdrive/e/decm/test1.py", line 60, in generate self.response.out.write(template.render(path, values, debug=_DEBUG)) ... Error: ReferenceProperty failed to be resolved
-----------end error----------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to goog...@googlegroups.com
To unsubscribe from this group, send email to
google-appengine+unsu...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---




