Actually, I take that back:
class avatar(webapp.RequestHandler):
def get(self,nameId='Larkin'):
IMG = PROFILES.gql("WHERE name = :1",nameId)
if (IMG[0].smallAvatar):
self.response.headers['Content-Type'] = "image/jpg"
self.response.out.write(IMG[0].smallAvatar)
else:
self.error(404)
with: (r'/avatar/(.*)',avatar),
doesn't seem to work...
basically /avatar/ doesn't return the same thing as /avatar/Larkin
On Sep 14, 7:16 pm, Larkin2 <[email protected]> wrote:
> Thanks Nick, that helped me isolate the problem and you are right,
> this works fine.
>
> Best,
>
> -L
>
> On Sep 14, 6:58 pm, "Nick Johnson (Google)" <[email protected]>
> wrote:
>
> > Hi Larkin,
>
> > On Mon, Sep 14, 2009 at 11:47 PM, Larkin2 <[email protected]> wrote:
>
> > > Hello, I have a class called home:
>
> > > class home(webapp.RequestHandler):
>
> > > with a get method:
>
> > > def get(self,userId, itemId):
>
> > > I call it with the following URL Handler:
>
> > > (r'/(.*)/(.*)', home),
>
> > > Problem is, I also want to be able to use home for not just '/userId/
> > > itemId/' - I want to be able to use it for just '/' or '/userId/', but
> > > this currently will not work because the get method is defined with
> > > two variable inputs.
>
> > > Is it possible to do what I'm suggesting with some kind of default
> > > userId and itemId setting?That is something like: def get
> > > (self,userId=0, itemId=0):
>
> > This will work fine. Have you tried it?
>
> > -Nick
>
> > > Thanks a million!
>
> > > Larkin
>
> > --
> > Nick Johnson, Developer Programs Engineer, App Engine
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---