For more details, see the very end of the book section on URL: 
http://web2py.com/book/default/chapter/04#URL

On Friday, May 27, 2011 1:39:38 AM UTC-4, Anthony wrote:

> The problem is that when you don't specify an extension in the URL() 
> function, it automatically defaults to the extension of the current request. 
> So, when you go to /mywiki/default/news.rss, that sets the extension of the 
> current request to 'rss'. So, when the news() function creates the URLs 
> using the URL() function, it automatically adds .rss extensions to the URLs. 
> The way to avoid that is to explicitly set the extension to 'html':
>  
> link = URL('show', extension='html', args=row.id)
>  
>  
> Of course, the problem with that is the URLs in the RSS feed will now look 
> like /mywiki/default/show.html/1, which will work but is ugly.
>  
> There's a trick, though -- instead, set extension to False:
>  
> link = URL('show', extension=False, args=row.id)
>  
>  
> In that case, the URL() function will not use request.extension (it only 
> does that if extension=None), nor will it try to add an extension to the 
> function name. I think this change will work with the upcoming release as 
> well (which includes a new version of the URL() function).
>  
> Note, I went ahead and made the above correction in the book.
>  
> Anthony
>  
>
> On Thursday, May 26, 2011 1:39:48 PM UTC-4, Chris May wrote:
>
>> I am using the book to learn more about web2py, and I was checking out 
>> the wiki example in chapter 3 (http://web2py.com/book/default/chapter/ 
>> 03#A-Wiki <http://web2py.com/book/default/chapter/03#A-Wiki> ), I noticed 
>> that the links inside the RSS feed come out 
>> slightly wrong. The links have ".rss" in between the app name and the 
>> row.id argument, as shown below. 
>>
>> "http://127.0.0.1:8000/mywiki/default/show.rss/2"; 
>>
>> That link sends me to either an "RSS error" page or a "401 
>> UNAUTHORIZED" page. I would expect the link to be: 
>>
>> "http://127.0.0.1:8000/mywiki/default/show/2"; 
>>
>> The code to create it, from the book is: 
>> "link = URL('show', args=row.id)," 
>>
>> Am I missing something?
>
>

Reply via email to