In HTML, if you want to specify an absolute URL, the "href" attribute must 
start with "http(s)://". Otherwise, the "href" attribute is considered to 
be relative to the URL of the current page (i.e., the browser simply 
appends it to the current URL). The URL you see when hovering over the link 
is generated by the browser, not web2py (if you look at the page's source 
code, you will simply see href="www.huffingtonpost.com", which the browser 
assumes is really a request for 
http://127.0.0.1:8000/welcome/view_a_site/www.huffingtonpost.com).

You are receiving the traceback because the view_a_site action expects an 
integer in request.args(0) (which is used in a DAL query), but of course it 
is instead the string "www.huffingtonpost.com".

So, just change the href to "http://www.huffingtonpost.com";.

Anthony

On Sunday, August 28, 2016 at 8:37:33 PM UTC-4, Steven Vannoy wrote:
>
> Hi, See below (or above) where I provide the entire traceback. Your code 
> does the same thing as Luise's in that when I hover over the link, it shows 
> it will try to resolve to: 
> 127.0.0.1:8000/welcome/view_a_site/www.huffingtonpost.com
>
> My app is 'welcome' and 'view_a_site' is the current view which is 
> displaying the link
>
> On Sunday, August 28, 2016 at 7:38:41 PM UTC-4, 黄祥 wrote:
>>
>> pls try:
>> {{if site.website:}}
>> {{=A(site.website, _title = T("Web site"), _target = "_blank", _href = 
>> "%s" % site.website) }}
>> {{pass}}
>>
>> best regards,
>> stifan
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to