# HG changeset patch # User ymh # Date 1371337420 -7200 # Node ID ae066d797a6647bed16feaea9868c7756bb3857d # Parent 221af1052ec44aed4379edfc8440083967050d02 add link to joconde search. Add option to import diff -r 221af1052ec4 -r ae066d797a66 sbin/sync/config.py.tmpl --- a/sbin/sync/config.py.tmpl Sat Jun 15 16:21:02 2013 +0200 +++ b/sbin/sync/config.py.tmpl Sun Jun 16 01:03:40 2013 +0200 @@ -47,8 +47,8 @@ env.config = { 'web': { - 'base_url': "/", - 'web_url': 'http://labs.iri-resesarch.org/jocondelab', + 'base_url': "/jocondelab/", + 'web_url': 'http://labs.iri-resesarch.org', 'db_engine':'postgresql_psycopg2', 'db_name':'jocondelab', 'db_user': 'iriuser', diff -r 221af1052ec4 -r ae066d797a66 src/core/wp_utils.py --- a/src/core/wp_utils.py Sat Jun 15 16:21:02 2013 +0200 +++ b/src/core/wp_utils.py Sun Jun 16 01:03:40 2013 +0200 @@ -130,7 +130,7 @@ -def get_or_create_term(term_label, term_uri, term_lang, thesaurus, wp_label_transform=(lambda l:l)): +def get_or_create_term(term_label, term_uri, term_lang, thesaurus, wp_label_transform=(lambda l:l), skip_wp_query=False): term_label_normalized = normalize_term(term_label) # We get the wikipedia references for the tag_label @@ -161,7 +161,7 @@ term_label_obj = TermLabel(label=term_label, term=term, lang=term_lang) term_label_obj.save() - elif term.wikipedia_pageid: + elif term.wikipedia_pageid and not skip_wp_query: wp_res = query_wikipedia_title(site, pageid=term.wikipedia_pageid) wikipedia_revision_id = wp_res['revision_id'] term.wikipedia_revision_id = wikipedia_revision_id diff -r 221af1052ec4 -r ae066d797a66 src/jocondelab/management/commands/import_terms.py --- a/src/jocondelab/management/commands/import_terms.py Sat Jun 15 16:21:02 2013 +0200 +++ b/src/jocondelab/management/commands/import_terms.py Sun Jun 16 01:03:40 2013 +0200 @@ -48,12 +48,20 @@ default= 50, help= 'number of object to import in bulk operations' ), + make_option('-s','--skip-wp', + dest= 'skip_wp_query', + action= 'store_true', + default= False, + help= 'skip wikipedia query' + ), + ) def handle_noargs(self, **options): batch_size = options.get('batch_size', 50) + skip_wp_query = options.get('skip_wp_query', False) transaction.enter_transaction_management() transaction.managed() @@ -83,7 +91,8 @@ term_uri=unicode(s), term_lang=lang, thesaurus = thes, - wp_label_transform = THESAURUS_LABEL_TRANSFORM.get(thes.label,lambda l:l) + wp_label_transform = THESAURUS_LABEL_TRANSFORM.get(thes.label,lambda l:l), + skip_wp_query=skip_wp_query ) if not ((i+1) % batch_size): @@ -91,7 +100,7 @@ transaction.commit() for i,(s,_,o) in enumerate(graph.triples((None, URIRef("http://www.w3.org/2004/02/skos/core#altLabel"), None), context=context)): - self.stdout.write("%d - Thesaurus %s term alt label %s" % (i+1, thes.label, repr(o))) + self.stdout.write("%d - Thesaurus %s term alt label %s for %s" % (i+1, thes.label, repr(o), repr(s))) try: term = Term.objects.get(uri=unicode(s)) alt_label = unicode(o).strip() @@ -99,7 +108,7 @@ if not TermLabel.objects.filter(label=alt_label, term=term).exists(): TermLabel.objects.create(label=alt_label, term=term, lang=lang) except Term.DoesNotExist: - self.stdout.write("Thesaurus %s term alt label %s doe not exists",(thes.label, o)) + self.stdout.write("Thesaurus %s term alt label %s for %s does not exists" % (thes.label, repr(o), repr(s))) if not ((i+1) % batch_size): transaction.commit() diff -r 221af1052ec4 -r ae066d797a66 src/jocondelab/static/jocondelab/img/red_cross_disabled.png Binary file src/jocondelab/static/jocondelab/img/red_cross_disabled.png has changed diff -r 221af1052ec4 -r ae066d797a66 src/jocondelab/templates/jocondelab/term_edit.html --- a/src/jocondelab/templates/jocondelab/term_edit.html Sat Jun 15 16:21:02 2013 +0200 +++ b/src/jocondelab/templates/jocondelab/term_edit.html Sun Jun 16 01:03:40 2013 +0200 @@ -1,5 +1,5 @@ {% extends "jocondelab/base.html" %} - +{% load i18n %} {% block js_import %} {{block.super}} @@ -79,13 +79,24 @@ {% if term.wikipedia_url and term.wikipedia_url != "" %} - {{term.label}} + {% if term.validated %} + {{term.label}} + {% else %} + {{term.label}} + {% endif %} {% else %}   {% endif %} - Ajouter un tag : OK + {% if term.validated %} + {% trans "Select Wikipedia page" %} : OK + {% else %} + {% trans "Select Wikipedia page" %} : OK + {% endif %} + + + Recherche joconde