Yep, you're right.  The referrer is not relative, if the host part of
your request changes, remove it.

http://docs.python.org/release/2.5.2/lib/string-methods.html







On Mon, Jan 17, 2011 at 14:28, Zeynel <[email protected]> wrote:
> Thanks! But I noticed that in this case relative urls do not work. I
> am not sure why. In the rest of the script all urls are relative.
>
>
> On Jan 17, 1:26 pm, Robert Kluin <[email protected]> wrote:
>> Hi Zeynel,
>>   Assuming webapp, how about:
>>     if self.request.referrer == '/whatever':
>>         self.redirect('/somespot')
>>     elf self.request.referrer == '/other':
>>         self.redirect('/aplace')
>>     else:
>>         self.redirect('/there')
>>
>>   Webapp's self.request is a WebOb request, so it is documented 
>> here:http://pythonpaste.org/webob/reference.html#id1
>>
>> Robert
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Jan 17, 2011 at 12:52, Zeynel <[email protected]> wrote:
>> > Hi,
>>
>> > I just added a new page "/hot" to sort by number of votes to articles.
>>
>> > VoteHandler handles the vote with
>>
>> > item.vote +=1
>> > item.put()
>> > self.redirect("/newest")
>>
>> > but now the new page "/hot" also refers to this VoteHandler.
>>
>> > After writing the new vote to the database I need to redirect to
>> > either /hot or /newest depending on the referrer.
>>
>> > I searched the group and stackoverflow
>> >http://stackoverflow.com/search?page=2&tab=relevance&q=redirect%20goo...
>> > but I could not find the answer.
>>
>> > Can anyone direct me to the right reference?
>>
>> > 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 
>> > athttp://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.
>
>

-- 
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