Commit a3ed42de authored by delanoe's avatar delanoe

modifié : constants.py

Ajout d'un champs par défault (indication to select a database)
Ajout d'une fonction pour avoir le type automatiquement.

	modifié :         ../scrapers/istex.py
	modifié :         ../scrapers/pubmed.py
Scrapers adaptés avec la nouvelle fonction resourcetype.

	modifié :         ../templates/pages/projects/project.html
Titres trop longs tronqués dans le jumbotron.
parent 78ce209d
......@@ -120,48 +120,56 @@ LANGUAGES = {
from gargantext.util.parsers import \
EuropressParser, RISParser, PubmedParser, ISIParser, CSVParser, ISTexParser
def resourcetype(name):
return [n[0] for n in enumerate(r['name'] for r in RESOURCETYPES) if n[1] == name][0]
RESOURCETYPES = [
# type 0
{ 'name': 'Select database below',
'parser': None,
'default_language': None,
},
# type 1
{ 'name': 'Europress (English)',
'parser': EuropressParser,
'default_language': 'en',
},
# type 1
# type 2
{ 'name': 'Europress (French)',
'parser': EuropressParser,
'default_language': 'fr',
},
# type 2
# type 3
{ 'name': 'Jstor (RIS format)',
'parser': RISParser,
'default_language': 'en',
},
# type 3
# type 4
{ 'name': 'Pubmed (XML format)',
'parser': PubmedParser,
'default_language': 'en',
},
# type 4
# type 5
{ 'name': 'Scopus (RIS format)',
'parser': RISParser,
'default_language': 'en',
},
# type 5
# type 6
{ 'name': 'Web of Science (ISI format)',
'parser': ISIParser,
'default_language': 'en',
},
# type 6
# type 7
{ 'name': 'Zotero (RIS format)',
'parser': RISParser,
'default_language': 'en',
},
# type 7
# type 8
{ 'name': 'CSV',
'parser': CSVParser,
'default_language': 'en',
},
# type 8
# type 9
{ 'name': 'ISTex',
'parser': ISTexParser,
'default_language': 'en',
......
......@@ -8,7 +8,7 @@ from traceback import print_tb
from django.shortcuts import redirect, render
from django.http import Http404, HttpResponseRedirect, HttpResponseForbidden
from gargantext.constants import RESOURCETYPES, QUERY_SIZE_N_MAX
from gargantext.constants import resourcetype, QUERY_SIZE_N_MAX
from gargantext.models.nodes import Node
from gargantext.util.db import session
from gargantext.util.http import JsonHttpResponse
......@@ -133,7 +133,7 @@ def save(request , project_id):
if filename!=False:
# add the uploaded resource to the corpus
corpus.add_resource(
type = int(8) # cf. constants.RESOURCETYPES
type = resourcetype('ISTex')
, path = filename
)
dwnldsOK+=1
......
......@@ -18,7 +18,7 @@ from traceback import print_tb
from django.shortcuts import redirect
from django.http import Http404, HttpResponseRedirect, HttpResponseForbidden
from gargantext.constants import RESOURCETYPES, QUERY_SIZE_N_MAX
from gargantext.constants import resourcetype, QUERY_SIZE_N_MAX
from gargantext.models.nodes import Node
from gargantext.util.db import session
from gargantext.util.db_cache import cache
......@@ -134,7 +134,7 @@ def save( request , project_id ) :
print(filename)
if filename != False:
# add the uploaded resource to the corpus
corpus.add_resource( type = int(3)
corpus.add_resource( type = resourcetype('Pubmed (XML format)')
, path = filename
, url = None
)
......
......@@ -32,7 +32,7 @@
{% if project %}
<h1>
<span class="glyphicon glyphicon-book" aria-hidden="true"></span>
{{ project.name }}</h1>
{{ project.name | truncatechars:25 }}</h1>
<!--<h3> {{number}} corpora </h3>-->
{% endif %}
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment