Hi Zeynel,
  When the main page renders, it will include something like: <img
src='img?img_id=asdnmmfd2fdg32d390dsf4gf3gg2'></img>.  That will cause
the user's browser to send a request to your apps "img" handler with
the "img_id" parameter, in this example the img_id parameter will
equal to "asdnmmfd2fdg32d390dsf4gf3gg2".  In your app it will be a
real key.



Robert






On Fri, Dec 3, 2010 at 16:24, Zeynel <[email protected]> wrote:
> In this line from Using Images Python API
> http://code.google.com/appengine/docs/python/images/usingimages.html#Serving
>
> greeting = db.get(self.request.get("img_id"))
>
> in
>
> class Image (webapp.RequestHandler):
>    def get(self):
>        greeting = db.get(self.request.get("img_id"))
>        if greeting.avatar:
>            self.response.headers['Content-Type'] = "image/png"
>            self.response.out.write(greeting.avatar)
>        else:
>            self.response.out.write("No image")
>
> Where does the "img_id" come from? The documentation says:
>
> We'll need to update the HTML of the Guestbook to pass the key of the
> greeting to the Image handler
>
> and gives these lines:
>
> self.response.out.write("<div><img src='img?img_id=%s'></img>" %
>                              greeting.key())
> self.response.out.write(' %s</div>' %
>                              cgi.escape(greeting.content))
>
> Can you please explain how img_id is passed from MainPage handler to
> Image handler? I am confused about what is happening here. Thanks?
>
> --
> 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.

Reply via email to