--- a/src/hdabo/django_wsgi.py Thu Jun 19 12:47:41 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-import os
-
-os.environ['DJANGO_SETTINGS_MODULE'] = 'spel.settings'
-
-import django.core.handlers.wsgi
-
-application = django.core.handlers.wsgi.WSGIHandler()
-
-if os.environ.get('PYDEV_DEBUG', "False").lower() in ["true", "1", "t"]:
- import pydevd #@UnresolvedImport
- pydevd.settrace(suspend=False)
--- a/src/hdabo/settings.py Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdabo/settings.py Fri Jun 20 13:10:39 2014 +0200
@@ -106,6 +106,7 @@
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.locale.LocaleMiddleware',
)
ROOT_URLCONF = 'hdabo.urls'
@@ -128,8 +129,19 @@
'django_extensions',
'haystack',
'hdabo',
+ 'hdalab',
)
+ugettext = lambda s:s
+LANGUAGES = (
+ ('fr', ugettext('French')),
+ ('en', ugettext('English')),
+ ('it', ugettext('Italian')),
+ ('de', ugettext('German')),
+ ('es', ugettext('Spanish')),
+ ('ja', ugettext('Japanese')),
+ #('zh-tw', ugettext('Chinese')),
+)
WIKIPEDIA_API_URL = "http://fr.wikipedia.org/w/api.php"
WIKIPEDIA_VERSION_PERMALINK_TEMPLATE = "http://fr.wikipedia.org/w/index.php?oldid=%s"
--- a/src/hdabo/urls.py Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdabo/urls.py Fri Jun 20 13:10:39 2014 +0200
@@ -3,6 +3,7 @@
from django.contrib.auth import urls as auth_url
from django.contrib.auth.decorators import login_required
from .views import AddOrUpdateFolder, Folders, SearchDatasheet, DeleteFolder
+from hdalab import urls as hdalab_url
# Uncomment the next two lines to enable the admin:
@@ -52,4 +53,5 @@
url(r'^folder/(?P<folder_pk>[\w-]+)$', login_required(AddOrUpdateFolder.as_view()), name='add_or_update_folder'),
url(r'^searchajax/$', login_required(SearchDatasheet()), name='searchajax'),
url(r'^deletefolder/(?P<folder_pk>[\w-]+)$', login_required(DeleteFolder.as_view()), name='delete_folder'),
+ url(r'^hdalab/', include(hdalab_url)),
)
--- a/src/hdalab/django_wsgi.py Thu Jun 19 12:47:41 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-import os
-
-os.environ['DJANGO_SETTINGS_MODULE'] = 'hdalab.settings'
-
-import django.core.handlers.wsgi
-
-application = django.core.handlers.wsgi.WSGIHandler()
-
-if os.environ.get('PYDEV_DEBUG', "False").lower() in ["true", "1", "t"]:
- import pydevd #@UnresolvedImport
- pydevd.settrace(suspend=False)
--- a/src/hdalab/management/commands/query_dbpedia.py Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdalab/management/commands/query_dbpedia.py Fri Jun 20 13:10:39 2014 +0200
@@ -195,7 +195,10 @@
except Exception as e:
- print "\nError processing resource %s : %s" %(rdf_uri,unicode(e))
+ if tag.dbpedia_uri:
+ print "\nError processing resource %s : %s" %(tag.dbpedia_uri,unicode(e))
+ else:
+ print "\nError processing resource %s" % unicode(e)
traceback.print_exception(type(e), e, sys.exc_info()[2])
--- a/src/hdalab/models/dataviz.py Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdalab/models/dataviz.py Fri Jun 20 13:10:39 2014 +0200
@@ -28,7 +28,7 @@
class Country(models.Model):
- dbpedia_uri = models.URLField(verify_exists=False, max_length=255, blank=False, null=False, db_index=True, unique=True)
+ dbpedia_uri = models.URLField(max_length=255, blank=False, null=False, db_index=True, unique=True)
class Meta:
app_label = 'hdalab'
@@ -43,10 +43,10 @@
class DbpediaFields(models.Model):
- dbpedia_uri = models.URLField(verify_exists=False, max_length=2048, blank=False, null=False, db_index=True, unique=False)
+ dbpedia_uri = models.URLField(max_length=2048, blank=False, null=False, db_index=True, unique=False)
tag = models.OneToOneField(Tag, blank=True, null=True, db_index=True, related_name="dbpedia_fields")
abstract = models.TextField(blank=True, null=True)
- thumbnail = models.URLField(verify_exists=False, max_length=2048, blank=True, null=True, db_index=False)
+ thumbnail = models.URLField(max_length=2048, blank=True, null=True, db_index=False)
label = models.CharField(max_length=2048, unique=False, blank=True, null=True)
class Meta:
--- a/src/hdalab/modwsgi.wsgi Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdalab/modwsgi.wsgi Fri Jun 20 13:10:39 2014 +0200
@@ -1,22 +1,18 @@
-import os
-import sys
-import site
-
-
+import os, sys, site
def application(environ, start_response):
global g_env_set
if 'g_env_set' not in globals() or not g_env_set:
- os.environ['DJANGO_SETTINGS_MODULE'] = environ['DJANGO_SETTINGS_MODULE']
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE',environ['DJANGO_SETTINGS_MODULE'])
prev_sys_path = list(sys.path)
sys.path.append(environ['PROJECT_PATH'])
- for path in environ.get('PYTHON_PATH', "").split(os.pathsep):
+ for path in environ.get('PYTHON_PATH',"").split(os.pathsep):
if path:
- site.addsitedir(path) #@UndefinedVariable
+ site.addsitedir(path)
new_sys_path = []
for item in list(sys.path):
@@ -29,7 +25,7 @@
import django.core.handlers.wsgi
_application = django.core.handlers.wsgi.WSGIHandler()
-
+
if environ.get('PYDEV_DEBUG', "False").lower() in ["true", "1", "t"]:
import pydevd #@UnresolvedImport
pydevd.settrace(suspend=False)
--- a/src/hdalab/templates/base.html Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdalab/templates/base.html Fri Jun 20 13:10:39 2014 +0200
@@ -1,4 +1,5 @@
{% load analytics %}
+{% load static %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{LANGUAGE_CODE}}" lang="{{LANGUAGE_CODE}}">
@@ -7,15 +8,15 @@
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="content-language" content="{{LANGUAGE_CODE}}" />
- <link rel="SHORTCUT ICON" href="{{STATIC_URL}}hdalab/img/favicon.ico" />
+ <link rel="SHORTCUT ICON" href="{% static 'hdalab/img/favicon.ico' %}" />
<title>{% block title %}HdA Lab{% endblock %}</title>
{% block css_import %}
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/common.css" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/common.css' %}" />
{% endblock %}
{% block js_import %}
- <script src="{{STATIC_URL}}hdalab/lib/jquery-1.7.1.min.js"></script>
+ <script src="{% static 'hdalab/lib/jquery-1.7.1.min.js' %}"></script>
{% endblock %}
</head>
@@ -24,15 +25,15 @@
{% block header %}
<div id="header">
<ul id="nav">
- <li><a class="{% block home_actif %}{% endblock %}" href="{% url home %}">Accueil</a></li>
+ <li><a class="{% block home_actif %}{% endblock %}" href="{% url 'home' %}">Accueil</a></li>
<li>—</li>
<li>Navigation par :</li>
- <li><a class="{% block facettes_actif %}{% endblock %}" href="{% url facettes %}">Facettes</a></li>
- <li><a class="{% block categories_actif %}{% endblock %}" href="{% url categories %}">Catégories de Wikipedia</a></li>
- <li><a class="{% block thesaurus_actif %}{% endblock %}" href="{% url thesaurus %}">Thésaurus</a></li>
+ <li><a class="{% block facettes_actif %}{% endblock %}" href="{% url 'facettes' %}">Facettes</a></li>
+ <li><a class="{% block categories_actif %}{% endblock %}" href="{% url 'categories' %}">Catégories de Wikipedia</a></li>
+ <li><a class="{% block thesaurus_actif %}{% endblock %}" href="{% url 'thesaurus' %}">Thésaurus</a></li>
</ul>
<h1>
- <a href="{% url home %}">HdA Lab</a>
+ <a href="{% url 'home' %}">HdA Lab</a>
</h1>
</div>
<div id="container">
@@ -51,12 +52,12 @@
</li>
<li>
<a href="http://culture.gouv.fr/" target="_blank">
- <img src="{{STATIC_URL}}hdalab/img/logo_mcc_blanc.png" />
+ <img src="{% static 'hdalab/img/logo_mcc_blanc.png' %}" />
</a>
</li>
<li>
<a href="http://www.iri-research.org/" target="_blank">
- <img src="{{STATIC_URL}}hdalab/img/logo_iri_blanc.png" />
+ <img src="{% static 'hdalab/img/logo_iri_blanc.png' %}" />
</a>
</li>
</ul>
--- a/src/hdalab/templates/categories.html Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdalab/templates/categories.html Fri Jun 20 13:10:39 2014 +0200
@@ -1,29 +1,30 @@
{% extends "base.html" %}
+{% load static %}
{% block title %}{{block.super}} > Recherche par arbre{% endblock %}
{% block css_import %}
{{block.super}}
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/ui-lightness/jquery-ui-1.8.16.custom.css" />
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/trees.css?refresh" />
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/cattree.css?refresh" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/ui-lightness/jquery-ui-1.8.16.custom.css' %}" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/trees.css?refresh' %}" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/cattree.css?refresh' %}" />
{% endblock %}
{% block js_import %}
{{block.super}}
- <script src="{{STATIC_URL}}hdalab/lib/underscore-min.js"></script>
- <script src="{{STATIC_URL}}hdalab/lib/mustache.js"></script>
- <script src="{{STATIC_URL}}hdalab/lib/jquery-ui-1.8.16.custom.min.js"></script>
+ <script src="{% static 'hdalab/lib/underscore-min.js' %}"></script>
+ <script src="{% static 'hdalab/lib/mustache.js' %}"></script>
+ <script src="{% static 'hdalab/lib/jquery-ui-1.8.16.custom.min.js' %}"></script>
<script type="text/javascript">
endpoints = {
- cat_search: "{% url cat_search %}",
- cat_tree: "{% url cat_tree %}",
- fill_tree: "{% url fill_tree %}",
- datasheet: "{% url notice 'ID' %}"
+ cat_search: "{% url 'cat_search' %}",
+ cat_tree: "{% url 'cat_tree' %}",
+ fill_tree: "{% url 'fill_tree' %}",
+ datasheet: "{% url 'notice' 'ID' %}"
};
</script>
- <script src="{{STATIC_URL}}hdalab/js/trees.js?refresh"></script>
- <script src="{{STATIC_URL}}hdalab/js/cattree.js?refresh"></script>
+ <script src="{% static 'hdalab/js/trees.js?refresh' %}"></script>
+ <script src="{% static 'hdalab/js/cattree.js?refresh' %}"></script>
{% endblock %}
{% block categories_actif %}actif{% endblock %}
--- a/src/hdalab/templates/facettes.html Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdalab/templates/facettes.html Fri Jun 20 13:10:39 2014 +0200
@@ -1,4 +1,5 @@
{% extends "base.html" %}
+{% load static %}
{% load i18n %}
@@ -6,30 +7,30 @@
{% block css_import %}
{{block.super}}
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/lib/leaflet/leaflet.css" />
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/ui-lightness/jquery-ui-1.8.16.custom.css" />
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/facettes.css?refresh" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/lib/leaflet/leaflet.css' %}" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/ui-lightness/jquery-ui-1.8.16.custom.css' %}" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/facettes.css?refresh' %}" />
{% endblock %}
{% block js_import %}
{{block.super}}
- <script src="{{STATIC_URL}}hdalab/lib/raphael-min.js"></script>
- <script src="{{STATIC_URL}}hdalab/lib/underscore-min.js"></script>
- <script src="{{STATIC_URL}}hdalab/lib/jquery-ui-1.8.16.custom.min.js"></script>
- <script src="{{STATIC_URL}}hdalab/lib/leaflet/leaflet.js"></script>
- <script src="{{STATIC_URL}}hdalab/lib/ZeroClipboard.js"></script>
+ <script src="{% static 'hdalab/lib/raphael-min.js' %}"></script>
+ <script src="{% static 'hdalab/lib/underscore-min.js' %}"></script>
+ <script src="{% static 'hdalab/lib/jquery-ui-1.8.16.custom.min.js' %}"></script>
+ <script src="{% static 'hdalab/lib/leaflet/leaflet.js' %}"></script>
+ <script src="{% static 'hdalab/lib/ZeroClipboard.js' %}"></script>
- <script src="{% url jsi18n 'hdalab' %}"></script>
- <script src="{{STATIC_URL}}hdalab/js/gomina.js?refresh"></script>
+ <script src="{% url 'jsi18n' 'hdalab' %}"></script>
+ <script src="{% static 'hdalab/js/gomina.js?refresh' %}"></script>
<script type="text/javascript">
gomNs.languageCode = '{{LANGUAGE_CODE}}';
gomNs.urls = {
- 'filter': "{% url filter %}",
- 'session_info': "{% url session_info %}",
- 'countries': "{{STATIC_URL}}hdalab/lib/countries.geo.json",
- 'tag_search': "{% url tag_search %}",
- 'datasheet': "{% url notice 'ID' %}"
+ 'filter': "{% url 'filter' %}",
+ 'session_info': "{% url 'session_info' %}",
+ 'countries': "{% static 'hdalab/lib/countries.geo.json' %}",
+ 'tag_search': "{% url 'tag_search' %}",
+ 'datasheet': "{% url 'notice' 'ID' %}"
};
ZeroClipboard.setMoviePath('{{STATIC_URL}}hdalab/lib/ZeroClipboard.swf');
</script>
@@ -43,7 +44,7 @@
</div>
<div id="titleright">
<div id='langselect'>
- <form action="{% url django.views.i18n.set_language %}" method="post" id="lang_form">
+ <form action="{% url 'django.views.i18n.set_language' %}" method="post" id="lang_form">
{% csrf_token %}
<!--input name="next" type="hidden" value="" /-->
{% get_language_info_list for LANGUAGES as languages %}
--- a/src/hdalab/templates/index.html Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdalab/templates/index.html Fri Jun 20 13:10:39 2014 +0200
@@ -1,10 +1,11 @@
{% extends "base.html" %}
+{% load static %}
{% block title %}{{block.super}} > Accueil{% endblock %}
{% block css_import %}
{{block.super}}
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/index.css" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/index.css' %}" />
{% endblock %}
{% block js_import %}
@@ -39,7 +40,7 @@
<div class="overlay-bloc">
<p>Recherchez les contenus d'Histoire des Arts par plusieurs points d'entrée : pays, périodes historiques, disciplines artistiques et mots-clés liés aux œvres.</p>
<p>Les éléments de l'interface sont à la fois des critères de recherche et des mode de visualisation des résultats : Au fur et à mesure de vos recherches, ils se mettent à jour pour refléter le nombre de contenus correspondant.</p>
- <p class="goto"><a href="{% url facettes %}">»</a></p>
+ <p class="goto"><a href="{% url 'facettes' %}">»</a></p>
</div>
</div>
</div>
@@ -51,7 +52,7 @@
<div class="overlay-bloc">
<p>Naviguez dans l'arbre des catégories de Wikipedia pour atteindre les contenus du portail Histoire des Arts.</p>
<p>Recherchez une catégorie par son titre, puis explorez les sous-catégories et les tags qui y sont rattachés.</p>
- <p class="goto"><a href="{% url categories %}">»</a></p>
+ <p class="goto"><a href="{% url 'categories' %}">»</a></p>
</div>
</div>
</div>
@@ -66,7 +67,7 @@
<li>La branche « Secteur urbain » du Thésaurus de l’architecture et de l’urbanisme (état 2010)</li>
<li>La branche « Architecture d’habitation » du Thésaurus iconographique Garnier (état 2012)</li>
</ul>
- <p class="goto"><a href="{% url thesaurus %}">»</a></p>
+ <p class="goto"><a href="{% url 'thesaurus' %}">»</a></p>
</div>
</div>
</div>
@@ -89,14 +90,14 @@
<div class="half-bloc">
<p>
<a href="http://culture.gouv.fr/" target="_blank" title="Ministère de la Culture et de la Communication">
- <img src="{{STATIC_URL}}hdalab/img/logo_mcc.png" alt="Ministère de la Culture et de la Communication" />
+ <img src="{% static 'hdalab/img/logo_mcc.png' %}" alt="Ministère de la Culture et de la Communication" />
</a>
</p>
</div>
<div class="half-bloc">
<p>
<a href="http://www.iri-research.org/" target="_blank">
- <img src="{{STATIC_URL}}hdalab/img/logo_iri.png" alt="Institut de Recherche et d'Innovation" />
+ <img src="{% static 'hdalab/img/logo_iri.png' %}" alt="Institut de Recherche et d'Innovation" />
</a>
</p>
</div>
--- a/src/hdalab/templates/notice.html Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdalab/templates/notice.html Fri Jun 20 13:10:39 2014 +0200
@@ -1,16 +1,17 @@
{% extends "base.html" %}
+{% load static %}
{% block title %}{{block.super}} > {{datasheet.title}}{% endblock %}
{% block css_import %}
{{block.super}}
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/notice.css?refresh" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/notice.css?refresh' %}" />
{% endblock %}
{% block js_import %}
{{block.super}}
- <script src="{{STATIC_URL}}hdalab/lib/underscore-min.js"></script>
- <script src="{{STATIC_URL}}hdalab/js/notice.js?refresh"></script>
+ <script src="{% static 'hdalab/lib/underscore-min.js' %}"></script>
+ <script src="{% static 'hdalab/js/notice.js?refresh' %}"></script>
{% endblock %}
{% block main_content %}
@@ -43,7 +44,7 @@
{% for ds in related %}
<li class="datasheet">
<img src="http://histoiredesarts.culture.fr/images/cached/images/{{ds.hda_id}}.jpg" />
- <h3><a href="{% url notice ds.hda_id %}">{{ds.title}}</a></h3>
+ <h3><a href="{% url 'notice' ds.hda_id %}">{{ds.title}}</a></h3>
<h4>{{ds.organisation_name}}</h4>
<ul class="datasheet-tags">{% for t in ds.ordered_tags %}<li data-tag-id="{{t.id}}" class="related-datasheet-tag {% if t.common %} common-tag{% endif %}">{{t.label}}</li>{% endfor %}</ul>
</li>
--- a/src/hdalab/templates/thesaurus.html Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdalab/templates/thesaurus.html Fri Jun 20 13:10:39 2014 +0200
@@ -1,27 +1,28 @@
{% extends "base.html" %}
+{% load static %}
{% block title %}{{block.super}} > Recherche par arbre{% endblock %}
{% block css_import %}
{{block.super}}
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/ui-lightness/jquery-ui-1.8.16.custom.css" />
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/trees.css?refresh" />
- <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}hdalab/css/thesaurus.css?refresh" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/ui-lightness/jquery-ui-1.8.16.custom.css' %}" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/trees.css?refresh' %}" />
+ <link rel="stylesheet" type="text/css" href="{% static 'hdalab/css/thesaurus.css?refresh' %}" />
{% endblock %}
{% block js_import %}
{{block.super}}
- <script src="{{STATIC_URL}}hdalab/lib/underscore-min.js"></script>
- <script src="{{STATIC_URL}}hdalab/lib/mustache.js"></script>
- <script src="{{STATIC_URL}}hdalab/lib/jquery-ui-1.8.16.custom.min.js"></script>
+ <script src="{% static 'hdalab/lib/underscore-min.js' %}"></script>
+ <script src="{% static 'hdalab/lib/mustache.js' %}"></script>
+ <script src="{% static 'hdalab/lib/jquery-ui-1.8.16.custom.min.js' %}"></script>
<script type="text/javascript">
endpoints = {
- fill_tree: "{% url fill_tree %}",
- datasheet: "{% url notice 'ID' %}"
+ fill_tree: "{% url 'fill_tree' %}",
+ datasheet: "{% url 'notice' 'ID' %}"
};
</script>
- <script src="{{STATIC_URL}}hdalab/js/trees.js?refresh"></script>
- <script src="{{STATIC_URL}}hdalab/js/thesaurus.js?refresh"></script>
+ <script src="{% static 'hdalab/js/trees.js?refresh' %}"></script>
+ <script src="{% static 'hdalab/js/thesaurus.js?refresh' %}"></script>
{% endblock %}
{% block thesaurus_actif %}actif{% endblock %}
--- a/src/hdalab/urls.py Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdalab/urls.py Fri Jun 20 13:10:39 2014 +0200
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-from django.conf.urls.defaults import patterns, include, url
-from django.contrib import admin
+from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
#from hdalab.views.ajax import filter
@@ -17,7 +16,7 @@
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
- url(r'^admin/', include(admin.site.urls)),
+ #url(r'^admin/', include(admin.site.urls)),
url(r'^i18n/', include('django.conf.urls.i18n')),
url('^jsi18n/?$', 'django.views.i18n.javascript_catalog', name='jsi18n.all'),
--- a/src/hdalab/views/ajax.py Thu Jun 19 12:47:41 2014 +0200
+++ b/src/hdalab/views/ajax.py Fri Jun 20 13:10:39 2014 +0200
@@ -19,6 +19,9 @@
import itertools
import uuid
+import logging
+logger = logging.getLogger(__name__)
+
def tagtranslation(request):
lang = request.GET.get('lang',request.LANGUAGE_CODE)
@@ -350,16 +353,22 @@
translations = {}
+ logger.debug("ICI 0")
if lang not in no_translate_langs:
- transqs = DbpediaFieldsTranslation.objects.filter(master__in = [ts.tag.dbpedia_fields for ts in qs], language_code = lang)
+ ts_list = []
+ for ts in qs:
+ if hasattr(ts, 'tag') and hasattr(ts.tag, 'dbpedia_fields') :
+ ts_list.append(ts.tag.dbpedia_fields)
+ transqs = DbpediaFieldsTranslation.objects.filter(master__in = ts_list, language_code = lang)
translations = dict([(trans.master_id,trans.label) for trans in transqs])
for ts in qs:
- match_tag = ts.tag.id in matchtagids
- contenus[ts.datasheet_id]['tags'].append({'id': ts.tag.id, 'label':ts.tag.label, 'order':ts.order, 'match': match_tag , 'translated_label': translations.get(ts.tag.dbpedia_fields.id, ts.tag.label) if ts.tag.dbpedia_fields is not None else ts.tag.label})
-
- if match_tag:
- contenus[ts.datasheet_id]['score'] += 2*max_tag_order - ts.order
+ if hasattr(ts, 'tag') and hasattr(ts.tag, 'dbpedia_fields') :
+ match_tag = ts.tag.id in matchtagids
+ contenus[ts.datasheet_id]['tags'].append({'id': ts.tag.id, 'label':ts.tag.label, 'order':ts.order, 'match': match_tag , 'translated_label': translations.get(ts.tag.dbpedia_fields.id, ts.tag.label) if ts.tag.dbpedia_fields is not None else ts.tag.label})
+
+ if match_tag:
+ contenus[ts.datasheet_id]['score'] += 2*max_tag_order - ts.order
if contentlist is None:
contenus = sorted(contenus.values(),key=lambda e: -e['score'])