Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
6ec787fe
Commit
6ec787fe
authored
Mar 11, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TYPOS]
parent
2c8ae069
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
15 deletions
+16
-15
db.py
gargantext_web/db.py
+1
-1
views_optimized.py
gargantext_web/views_optimized.py
+2
-1
EuropressFileParser.py
parsing/FileParsers/EuropressFileParser.py
+13
-13
No files found.
gargantext_web/db.py
View file @
6ec787fe
...
@@ -149,7 +149,7 @@ class ModelCache(dict):
...
@@ -149,7 +149,7 @@ class ModelCache(dict):
key
=
getattr
(
element
,
column_name
)
key
=
getattr
(
element
,
column_name
)
self
[
key
]
=
element
self
[
key
]
=
element
class
Cache
:
class
Cache
()
:
def
__getattr__
(
self
,
key
):
def
__getattr__
(
self
,
key
):
try
:
try
:
...
...
gargantext_web/views_optimized.py
View file @
6ec787fe
...
@@ -81,7 +81,7 @@ def project(request, project_id):
...
@@ -81,7 +81,7 @@ def project(request, project_id):
# deal with the form
# deal with the form
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
# fo
mr
validation
# fo
rm
validation
form
=
CustomForm
(
request
.
POST
,
request
.
FILES
)
form
=
CustomForm
(
request
.
POST
,
request
.
FILES
)
if
form
.
is_valid
():
if
form
.
is_valid
():
# extract information from the form
# extract information from the form
...
@@ -89,6 +89,7 @@ def project(request, project_id):
...
@@ -89,6 +89,7 @@ def project(request, project_id):
thefile
=
form
.
cleaned_data
[
'file'
]
thefile
=
form
.
cleaned_data
[
'file'
]
print
(
"thetype:"
,
form
.
cleaned_data
[
'type'
])
# <-- e.g: im receiving "isi"
print
(
"thetype:"
,
form
.
cleaned_data
[
'type'
])
# <-- e.g: im receiving "isi"
resourcetype
=
cache
.
ResourceType
[
form
.
cleaned_data
[
'type'
]]
# e.g: here it converts to "pubmed" idk why
resourcetype
=
cache
.
ResourceType
[
form
.
cleaned_data
[
'type'
]]
# e.g: here it converts to "pubmed" idk why
print
(
"resourcetype:"
,
resourcetype
)
# which default language shall be used?
# which default language shall be used?
if
resourcetype
.
name
==
"europress_french"
:
if
resourcetype
.
name
==
"europress_french"
:
language_id
=
cache
.
Language
[
'fr'
]
.
id
language_id
=
cache
.
Language
[
'fr'
]
.
id
...
...
parsing/FileParsers/EuropressFileParser.py
View file @
6ec787fe
...
@@ -94,10 +94,10 @@ class EuropressFileParser(FileParser):
...
@@ -94,10 +94,10 @@ class EuropressFileParser(FileParser):
format_journal
=
re
.
compile
(
'(.*), (.*)'
,
re
.
UNICODE
)
format_journal
=
re
.
compile
(
'(.*), (.*)'
,
re
.
UNICODE
)
test_journal
=
format_journal
.
match
(
name
.
text
)
test_journal
=
format_journal
.
match
(
name
.
text
)
if
test_journal
is
not
None
:
if
test_journal
is
not
None
:
metadata
[
'
source
'
]
=
test_journal
.
group
(
1
)
metadata
[
'
journal
'
]
=
test_journal
.
group
(
1
)
metadata
[
'volume'
]
=
test_journal
.
group
(
2
)
metadata
[
'volume'
]
=
test_journal
.
group
(
2
)
else
:
else
:
metadata
[
'
source
'
]
=
name
.
text
.
encode
(
codif
)
metadata
[
'
journal
'
]
=
name
.
text
.
encode
(
codif
)
for
header
in
html_article
.
xpath
(
header_xpath
):
for
header
in
html_article
.
xpath
(
header_xpath
):
try
:
try
:
...
@@ -169,7 +169,7 @@ class EuropressFileParser(FileParser):
...
@@ -169,7 +169,7 @@ class EuropressFileParser(FileParser):
metadata
[
'page'
]
=
test_page
.
group
(
1
)
.
encode
(
codif
)
metadata
[
'page'
]
=
test_page
.
group
(
1
)
.
encode
(
codif
)
metadata
[
'title'
]
=
html_article
.
xpath
(
title_xpath
)
.
encode
(
codif
)
metadata
[
'title'
]
=
html_article
.
xpath
(
title_xpath
)
.
encode
(
codif
)
metadata
[
'
tex
t'
]
=
html_article
.
xpath
(
text_xpath
)
metadata
[
'
abstrac
t'
]
=
html_article
.
xpath
(
text_xpath
)
line
=
0
line
=
0
br_tag
=
10
br_tag
=
10
...
@@ -215,25 +215,25 @@ class EuropressFileParser(FileParser):
...
@@ -215,25 +215,25 @@ class EuropressFileParser(FileParser):
metadata
[
'publication_year'
]
=
metadata
[
'publication_date'
]
.
strftime
(
'
%
Y'
)
metadata
[
'publication_year'
]
=
metadata
[
'publication_date'
]
.
strftime
(
'
%
Y'
)
metadata
[
'publication_month'
]
=
metadata
[
'publication_date'
]
.
strftime
(
'
%
m'
)
metadata
[
'publication_month'
]
=
metadata
[
'publication_date'
]
.
strftime
(
'
%
m'
)
metadata
[
'publication_day'
]
=
metadata
[
'publication_date'
]
.
strftime
(
'
%
d'
)
metadata
[
'publication_day'
]
=
metadata
[
'publication_date'
]
.
strftime
(
'
%
d'
)
metadata
[
'publication_date'
]
=
""
metadata
.
pop
(
'publication_date'
)
if
len
(
metadata
[
'
tex
t'
])
>
0
and
format_europresse
==
50
:
if
len
(
metadata
[
'
abstrac
t'
])
>
0
and
format_europresse
==
50
:
metadata
[
'doi'
]
=
str
(
metadata
[
'
tex
t'
][
-
9
])
metadata
[
'doi'
]
=
str
(
metadata
[
'
abstrac
t'
][
-
9
])
metadata
[
'
tex
t'
]
.
pop
()
metadata
[
'
abstrac
t'
]
.
pop
()
# Here add separator for paragraphs
# Here add separator for paragraphs
metadata
[
'
text'
]
=
str
(
' '
.
join
(
metadata
[
'tex
t'
]))
metadata
[
'
abstract'
]
=
str
(
' '
.
join
(
metadata
[
'abstrac
t'
]))
metadata
[
'
text'
]
=
str
(
re
.
sub
(
'Tous droits réservés.*$'
,
''
,
metadata
[
'tex
t'
]))
metadata
[
'
abstract'
]
=
str
(
re
.
sub
(
'Tous droits réservés.*$'
,
''
,
metadata
[
'abstrac
t'
]))
elif
format_europresse
==
1
:
elif
format_europresse
==
1
:
metadata
[
'doi'
]
=
' '
.
join
(
html_article
.
xpath
(
doi_xpath
))
metadata
[
'doi'
]
=
' '
.
join
(
html_article
.
xpath
(
doi_xpath
))
metadata
[
'
text'
]
=
metadata
[
'tex
t'
][:
-
9
]
metadata
[
'
abstract'
]
=
metadata
[
'abstrac
t'
][:
-
9
]
# Here add separator for paragraphs
# Here add separator for paragraphs
metadata
[
'
text'
]
=
str
(
' '
.
join
(
metadata
[
'tex
t'
]))
metadata
[
'
abstract'
]
=
str
(
' '
.
join
(
metadata
[
'abstrac
t'
]))
else
:
else
:
metadata
[
'doi'
]
=
"not found"
metadata
[
'doi'
]
=
"not found"
metadata
[
'length_words'
]
=
len
(
metadata
[
'
tex
t'
]
.
split
(
' '
))
metadata
[
'length_words'
]
=
len
(
metadata
[
'
abstrac
t'
]
.
split
(
' '
))
metadata
[
'length_letters'
]
=
len
(
metadata
[
'
tex
t'
])
metadata
[
'length_letters'
]
=
len
(
metadata
[
'
abstrac
t'
])
metadata
[
'bdd'
]
=
u'europresse'
metadata
[
'bdd'
]
=
u'europresse'
metadata
[
'url'
]
=
u''
metadata
[
'url'
]
=
u''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment