correction of a big bug concerning the get_web_url call in models
authorgrandjoncl
Tue, 04 Dec 2012 13:11:19 +0100
changeset 1009 760f6643d4cf
parent 1008 122c9f3a933a
child 1010 a8a42538ba0e
correction of a big bug concerning the get_web_url call in models
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: