source: mauRepo/MolesManager/trunk/cedaMoles/MolesManager/__init__.py @ 8537

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/cedaMoles/MolesManager/__init__.py@8537
Revision 8537, 685 bytes checked in by mnagni, 7 years ago (diff)

Incomplete - # 22528: Migration of FAtCat Open Search link for HPFeld
 http://team.ceda.ac.uk/trac/ceda/ticket/22528

Line 
1import os
2def get_application_root_url(request):
3    """
4        Returns a string reflecting the full URL relative to the actual deployment.
5        Looks inside the os.environ dict a key named 'CEDA_MOLES_ROOT_URL'.
6        If not found assumes the root path is '/'
7       
8        **PARAMETERS""
9         * `HTTPRequest` **request**:
10             a django.HttpRequest
11    """
12    root_url = ''
13    if os.environ.has_key('CEDA_MOLES_ROOT_URL') \
14            and len(os.environ['CEDA_MOLES_ROOT_URL'].strip()) > 0:
15        root_url = os.environ['CEDA_MOLES_ROOT_URL']
16        return 'http://%s/%s/' %  (request.get_host(), root_url)
17   
18    return 'http://%s/' %  request.get_host()
Note: See TracBrowser for help on using the repository browser.