Hello All(),
I have been struggling with attempting to run a datastore query and
keep getting the same error even though I have read through all the
docs on Queries and Keys, watching several of the Google I/O videos,
as well as looking at a number other apps' source code to see how they
are done.
The error I get is:
Traceback (most recent call last):
File /Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/ext/webapp/__init__.py, line 507, in __call__
handler.get(*groups)
File /Users/msjen/Dev/alex/alexsbarbooking/editband.py, line 41,
in get
self._displayEditBandPage()
File /Users/msjen/Dev/alex/alexsbarbooking/editband.py, line 32,
in _displayEditBandPage
raise ValueError, 'Band with ID %d does not exist.' % id
ValueError: Band with ID 2 does not exist.
My code is:
id = int(self.request.get('id'))
band_id = Band.get(db.Key.from_path('Band', id))
if band_id:
band_query = Band.gql(WHERE ID = , id)
band = band_query.fetch(1)
self.response.out.write('Band query successful. %s : %d' %
band.band_name, id)
if not band_edit:
raise ValueError, 'Band query with ID %d did not get the info
from the datastore.' % id
if not band_id:
raise ValueError, 'Band with ID %d does not exist.' % id
I have imported the db.model of band:
from band import Band
The other error I get if I use other code samples is that the global
variable of 'band' is not recognized, even though I have imported the
model.
the URL path that I am requesting the id from is:
http://localhost:8080/editband/?id=2
And I am able to run a self.write.reponse to write out the requested
id from the path.
The problem seems to lie in passing the requested path id into the
query where I want to filter it by the requested id.
Please, please, tell me that another set of eyes can spot what I am
doing wrong here
Thanks in advance,
Jen
--
You received this message because you are subscribed to the Google Groups
Google App Engine group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.