Hi Wesley!

Bizarrely, or not so much, many solutions to ongoing/hard problems
come to me at night, so during a bout of insomnia the night before
last, my brain said, "Research how to get by Key, then unit test for
ID in the SDK console." And so, I did today and it now is working!
Yay.

Here is the solution I found, since I did want to use the unique ID
but didn't quite know how to get there as I kept getting different
errors.

Code that is now working happily:
    k = self.request.get('id')
    q = int(k)
    band = Band.get_by_id(q)
    template_values = {
        'band': band,
        }
    path = os.path.join(os.path.dirname(__file__), 'editband.html')
    self.response.out.write(template.render(path, template_values))

In explanation, I had to separate out the requesting of the id in the
string of the URL from making the id an integer before getting from
the datastore, as every time I tried to combine the first two lines
into
k= int(self.request.get('id'))
I got an error about integers as noted in one of my many emails above.

Now it is working, I have a clean URL, as I did not want to use the
Key, and I don't have to worry about using the band name in the URL.
I have two more things to fix in the post part of edit band, and then
I can share the url on appspot with you all.

Once again, thanks for all the input.
-- 
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.


Reply via email to