etwist/server.py
changeset 9779 3f1685ac2f16
parent 9543 39f981482e34
child 9890 57e2cffa6329
equal deleted inserted replaced
9778:23bad0114b84 9779:3f1685ac2f16
    44 def start_task(interval, func):
    44 def start_task(interval, func):
    45     lc = task.LoopingCall(func)
    45     lc = task.LoopingCall(func)
    46     # wait until interval has expired to actually start the task, else we have
    46     # wait until interval has expired to actually start the task, else we have
    47     # to wait all tasks to be finished for the server to be actually started
    47     # to wait all tasks to be finished for the server to be actually started
    48     lc.start(interval, now=False)
    48     lc.start(interval, now=False)
    49 
       
    50 def host_prefixed_baseurl(baseurl, host):
       
    51     scheme, netloc, url, query, fragment = urlsplit(baseurl)
       
    52     netloc_domain = '.' + '.'.join(netloc.split('.')[-2:])
       
    53     if host.endswith(netloc_domain):
       
    54         netloc = host
       
    55     baseurl = urlunsplit((scheme, netloc, url, query, fragment))
       
    56     return baseurl
       
    57 
    49 
    58 
    50 
    59 class CubicWebRootResource(resource.Resource):
    51 class CubicWebRootResource(resource.Resource):
    60     def __init__(self, config, repo):
    52     def __init__(self, config, repo):
    61         resource.Resource.__init__(self)
    53         resource.Resource.__init__(self)