Hey Zeynel,
Every entity has a key, see:
http://code.google.com/appengine/docs/python/datastore/keyclass.html
There is a query to get some greetings, followed by a loop:
greetings = db.GqlQuery (query_str)
for greeting in greetings:
# do stuff...
That each time through the loop, the variable 'greeting' is set to
the next Greeting instance returned by the query; so the greetings all
have key attributes.
You need to find yourself a HTML reference. the <img> tag does not
exactly 'render' the image, it tells the browser where to find the
image. The browser then sends a request to the url in the href
attribute, just as though you typed that url in the address bar of
your browser.
http://www.w3schools.com/tags/tag_img.asp
Robert
On Fri, Dec 3, 2010 at 23:55, Zeynel <[email protected]> wrote:
> On Dec 3, 11:25 pm, Robert Kluin <[email protected]> wrote:
>
>> When the main page renders, it will include something like: <img
>> src='img?img_id=asdnmmfd2fdg32d390dsf4gf3gg2'></img>.
>
> Hello Robert:
>
> Thanks for the answer. Unfortunately, I still fail to understand what
> is going on here. This line
>
> <img src='img?img_id=asdnmmfd2fdg32d390dsf4gf3gg2'></img>
>
> must be this line
>
> self.response.out.write("<div><img src='img?img_id=%s'></img>" %
> greeting.key())
>
> when
>
> greeting.key() is substituted. Correct?
>
> How does app engine know to get the key for greeting.avatar? greeting
> is defined as one row in the Greeting table fetched by the query. I
> think that key() is associated with a stored entity not with the query
> object. My apologies for being so confused.
>
> And I don't understand the order. As far as understand, the image is
> rendered by this line
>
> self.response.out.write("<div><img src='img?img_id=%s'></img>" %
> greeting.key())
>
> if so, why is the key sent to Image handler after the image is
> rendered?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.