On Feb 9, 2011, at 2:54 PM, Jonathan Lundell wrote:
> On Feb 9, 2011, at 2:24 PM, Anthony wrote:
>> Do we want to handle websocket URLs as well (i.e., ws and wss schemes 
>> instead of http and https)?
> 
> I don't know. Is there an RFC yet?
> 
> I've sent Massimo a patch already, but I could redo it to directly specify 
> scheme= instead of secure=, and allow an arbitrary string.
> 
> Now would be the time...

OK, I made the change. scheme='wss' (for example) works. 

scheme=True uses the scheme from request.env

> 
>> 
>> On Wednesday, February 9, 2011 5:02:38 PM UTC-5, Jonathan Lundell wrote:
>> On Feb 9, 2011, at 1:24 PM, howesc wrote:
>> > good, bad, or indifferent, because of varied testing and deployment 
>> > setups, and using multiple ports, i have the function below in my app.  
>> > note that i have database configuration for HTTPS scheme and port.  It's 
>> > my hack not not run internal test and development servers on port 443. :)
>> Thanks. I'd forgotten about port; I'll add that as well.
>> 
>> > 
>> > def full_url(scheme="http",
>> >     a=None,
>> >     c=None,
>> >     f=None,
>> >     r=None,
>> >     args=[],
>> >     vars={},
>> >     anchor='',
>> >     path = None
>> >     ):
>> >     """
>> >     Create a fully qualified URL.  The URL will use the same host as the
>> >     request was made from, but will use the specified scheme.  Calls
>> >     C{gluon.html.URL()} to construct the relative path to the host.
>> > 
>> >     if <scheme>_port is set in the settings table, append the port to the
>> >     domain of the created URL
>> > 
>> >     @param scheme: scheme to use for the fully-qualified URL.
>> >        (default to 'http')
>> >     @param a: application (default to current if r is given)
>> >     @param c: controller (default to current if r is given)
>> >     @param f: function (default to current if r is given)
>> >     @param r: request
>> >     @param args: any arguments (optional)
>> >     @param vars: any variables (optional)
>> >     @param anchor: anchorname, without # (optional)
>> >     @param path: the relative path to use.  if used overrides a,c,f,args, 
>> > and
>> >       vars (optional)
>> >     """
>> >     port = ''
>> >     if sitesettings.has_key(scheme+"_port") and 
>> > sitesettings[scheme+"_port"]:
>> >         port = ":" + sitesettings[scheme+"_port"]
>> >     if scheme == 'https' and sitesettings.has_key("https_scheme"):
>> >         scheme = sitesettings.https_scheme
>> >     url = scheme +'://' + \
>> >         r.env.http_host.split(':')[0] + port
>> >     if path:
>> >         url = url + path
>> >     else:
>> >         url = url+URL(a=a, c=c, f=f, r=r, args=args, vars=vars, 
>> > anchor=anchor)
>> >     return url
>> >
>> 
>> 
>> 
>> 
>> 
> 
> 


Reply via email to