# HG changeset patch # User grandjoncl # Date 1354623079 -3600 # Node ID 760f6643d4cf3abaa12d5aa2fb81a0477f23151c # Parent 122c9f3a933abf3435ff23ef444c3af7a9419c7f correction of a big bug concerning the get_web_url call in models diff -r 122c9f3a933a -r 760f6643d4cf src/ldt/ldt/ldt_utils/models.py --- a/src/ldt/ldt/ldt_utils/models.py Mon Dec 03 16:16:29 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/models.py Tue Dec 04 13:11:19 2012 +0100 @@ -1,6 +1,7 @@ from django.conf import settings from django.contrib.auth.models import User, Group from django.db import models +from django.contrib.sites.models import Site from django.utils.translation import ugettext_lazy as _ from guardian.shortcuts import assign, remove_perm, get_perms from ldt.core.models import Document @@ -14,7 +15,6 @@ from utils import (create_ldt, copy_ldt, create_empty_iri, update_iri, generate_uuid) from ldt.utils import generate_hash -from ldt.utils.url import get_web_url import datetime import lxml.etree #@UnresolvedImport import mimetypes @@ -24,6 +24,7 @@ import uuid from shutil import move from django.core.files.storage import default_storage +import logging #from ldt.core.models import Document, Owner @@ -301,7 +302,9 @@ def __unicode__(self): return str(self.id) + ":" + self.iri_id + ":" + self.title.replace("\n", " ") - def iri_url(self, web_url=get_web_url()): + def iri_url(self, web_url=None): + if not web_url: + web_url='http://'+Site.objects.get_current().domain if url_utils.is_absolute(self.iriurl): return self.iriurl else: