You have to specify a non-falsey value for f. Sorry, but I don't think you 
can do what you want to do with the URL() function. Since it's an external 
URL, just write the URL by hand. To build the query string, just do:

import urllib
query = urllib.urlencode(params)

And if you don't want the encoding:

query = urllib.unquote(query)

Anthony

On Wednesday, April 23, 2014 12:15:19 PM UTC-4, JoeCodeswell wrote:

> Dear Anthony,
>
> Thanks for the response. 
>
> Is this a web2py URL, or are you just trying to use the URL() function to 
>> generate an external URL (not its intended purpose)?
>
>
> I am trying to use the URL() function to generate an external URL. I 
> didn't know that was not its intended purpose.
>
> you cannot leave out the function -- in that case,...
>
>
> I thought I specified a value for f==''. 
>
> authorize_url_0 = URL(a='oauth2', c='authorize', f='',   ...
>
> How do I make the f == '' i.e. blank? 
>
> Thanks again, Anthony.
>
> Love and peace,
>
> Joe
>
>
> On Wednesday, April 23, 2014 9:04:22 AM UTC-7, Anthony wrote:
>>
>> Is this a web2py URL, or are you just trying to use the URL() function to 
>> generate an external URL (not its intended purpose)? Anyway, you cannot 
>> leave out the function -- in that case, it assumes the app is the 
>> controller, the controller is the function, and the current app is the true 
>> app.
>>
>> Anthony
>>
>> On Wednesday, April 23, 2014 11:11:45 AM UTC-4, JoeCodeswell wrote:
>>
>>> Dear web2py users group,
>>>
>>> I am trying to generate an absolute URL using the URL helper to connect 
>>> with WordPress.com.
>>> Here's the code:
>>> wpcc_consts = {
>>>
>>>     "client_id": '12345', #Joe's
>>>     "redirect_uri": URL(f='connected', scheme='http', host='
>>> joecodeswell.com', url_encode=False),
>>>
>>>     # see http://developer.wordpress.com/docs/oauth2/
>>>     "wp_authorize_endpoint": "
>>> https://public-api.wordpress.com/oauth2/authorize";,
>>>     "wp_token_request_endpoint": "
>>> https://public-api.wordpress.com/oauth2/token";,
>>>     "client_secret": "blablabla", #Joes
>>> }
>>>
>>> params = {
>>>         "response_type": "code",
>>>         "client_id": wpcc_consts['client_id'],
>>>         "redirect_uri": URL(f='connected', scheme='http', host='
>>> joecodeswell.com', url_encode=False),
>>> }
>>>
>>> authorize_url_0 = URL(a='oauth2', c='authorize', f='', vars=params,scheme
>>> ='https', host='public-api.wordpress.com', url_encode=False)
>>>
>>> In [16]: authorize_url_0
>>> Out[16]: '
>>> https://public-api.wordpress.com/wpcomconn/oauth2/authorize?client_id=34759&redirect_uri=http://joecodeswell.com/wpcomconn/default/connected&response_type=code
>>> '
>>>
>>>
>>> Question
>>>
>>> Why is 'wpcomconn', the name of the app in which this is getting 
>>> executed, showing up right after 'public-api.wordpress.com/'? In the 
>>> absolute URL spec i defined a='oauth2', but it shows up after the 
>>> current app.
>>>
>>> Thanks for the help in advance.
>>> Love and peace,
>>>
>>> Joe
>>> Love and peace,
>>>
>>> Joe
>>>
>>>
>>>
>>>

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