src/ldt/ldt/utils/web_url_management.py
author cavaliet
Thu, 11 Apr 2013 10:15:51 +0200
changeset 1145 160b769463b6
parent 1010 a8a42538ba0e
child 1503 ed7bcbefc941
permissions -rw-r--r--
Added tag V01.46.04 for changeset 5647cbc32e53
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1010
a8a42538ba0e modification of get_web_url to have less dependances and be usable in ldt_utils->models
grandjoncl
parents:
diff changeset
     1
from django.contrib.sites.models import Site
a8a42538ba0e modification of get_web_url to have less dependances and be usable in ldt_utils->models
grandjoncl
parents:
diff changeset
     2
a8a42538ba0e modification of get_web_url to have less dependances and be usable in ldt_utils->models
grandjoncl
parents:
diff changeset
     3
def get_web_url(request=None):
a8a42538ba0e modification of get_web_url to have less dependances and be usable in ldt_utils->models
grandjoncl
parents:
diff changeset
     4
    if request:
a8a42538ba0e modification of get_web_url to have less dependances and be usable in ldt_utils->models
grandjoncl
parents:
diff changeset
     5
        if request.is_secure():
a8a42538ba0e modification of get_web_url to have less dependances and be usable in ldt_utils->models
grandjoncl
parents:
diff changeset
     6
            domain = "https://%s" % Site.objects.get_current().domain
a8a42538ba0e modification of get_web_url to have less dependances and be usable in ldt_utils->models
grandjoncl
parents:
diff changeset
     7
        else:
a8a42538ba0e modification of get_web_url to have less dependances and be usable in ldt_utils->models
grandjoncl
parents:
diff changeset
     8
            domain = "http://%s" % Site.objects.get_current().domain
a8a42538ba0e modification of get_web_url to have less dependances and be usable in ldt_utils->models
grandjoncl
parents:
diff changeset
     9
    else : 
a8a42538ba0e modification of get_web_url to have less dependances and be usable in ldt_utils->models
grandjoncl
parents:
diff changeset
    10
        domain = "http://%s" % Site.objects.get_current().domain
a8a42538ba0e modification of get_web_url to have less dependances and be usable in ldt_utils->models
grandjoncl
parents:
diff changeset
    11
    return domain