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
30161f63
Commit
30161f63
authored
Sep 19, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] corpus type was none in doc view etc
parent
a5cfb903
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
constants.py
gargantext/constants.py
+2
-4
corpora.py
gargantext/views/pages/corpora.py
+13
-4
No files found.
gargantext/constants.py
View file @
30161f63
...
@@ -119,10 +119,8 @@ INDEXED_HYPERDATA = {
...
@@ -119,10 +119,8 @@ INDEXED_HYPERDATA = {
# resources ---------------------------------------------
# resources ---------------------------------------------
def
get_resource
(
sourcetype
):
def
get_resource
(
sourcetype
):
'''resource :: type => resource dict'''
'''resource :: type => resource dict'''
for
n
in
RESOURCETYPES
:
return
RESOURCETYPES
[
sourcetype
-
1
]
if
int
(
n
[
"type"
])
==
int
(
sourcetype
):
return
n
return
None
def
get_resource_by_name
(
sourcename
):
def
get_resource_by_name
(
sourcename
):
'''resource :: name => resource dict'''
'''resource :: name => resource dict'''
for
n
in
RESOURCETYPES
:
for
n
in
RESOURCETYPES
:
...
...
gargantext/views/pages/corpora.py
View file @
30161f63
...
@@ -28,6 +28,8 @@ def docs_by_titles(request, project_id, corpus_id):
...
@@ -28,6 +28,8 @@ def docs_by_titles(request, project_id, corpus_id):
authorized
,
user
,
project
,
corpus
=
_get_user_project_corpus
(
request
,
project_id
,
corpus_id
)
authorized
,
user
,
project
,
corpus
=
_get_user_project_corpus
(
request
,
project_id
,
corpus_id
)
if
not
authorized
:
if
not
authorized
:
return
HttpResponseForbidden
()
return
HttpResponseForbidden
()
source_type
=
corpus
.
resources
()[
0
][
'type'
]
# response!
# response!
return
render
(
return
render
(
template_name
=
'pages/corpora/titles.html'
,
template_name
=
'pages/corpora/titles.html'
,
...
@@ -37,7 +39,7 @@ def docs_by_titles(request, project_id, corpus_id):
...
@@ -37,7 +39,7 @@ def docs_by_titles(request, project_id, corpus_id):
'date'
:
datetime
.
now
(),
'date'
:
datetime
.
now
(),
'project'
:
project
,
'project'
:
project
,
'corpus'
:
corpus
,
'corpus'
:
corpus
,
'resourcename'
:
get_resource
_by_name
(
corpus
.
resources
()[
0
])
,
'resourcename'
:
get_resource
(
source_type
)[
'name'
]
,
'view'
:
'titles'
,
'view'
:
'titles'
,
'user'
:
request
.
user
'user'
:
request
.
user
},
},
...
@@ -56,6 +58,8 @@ def docs_by_journals(request, project_id, corpus_id):
...
@@ -56,6 +58,8 @@ def docs_by_journals(request, project_id, corpus_id):
# and the project just for project.id in corpusBannerTop
# and the project just for project.id in corpusBannerTop
project
=
cache
.
Node
[
project_id
]
project
=
cache
.
Node
[
project_id
]
source_type
=
corpus
.
resources
()[
0
][
'type'
]
# rendered page : journals.html
# rendered page : journals.html
return
render
(
return
render
(
template_name
=
'pages/corpora/journals.html'
,
template_name
=
'pages/corpora/journals.html'
,
...
@@ -65,7 +69,7 @@ def docs_by_journals(request, project_id, corpus_id):
...
@@ -65,7 +69,7 @@ def docs_by_journals(request, project_id, corpus_id):
'date'
:
datetime
.
now
(),
'date'
:
datetime
.
now
(),
'project'
:
project
,
'project'
:
project
,
'corpus'
:
corpus
,
'corpus'
:
corpus
,
'resourcename'
:
get_resource
_by_name
(
corpus
.
resources
()[
0
])
,
'resourcename'
:
get_resource
(
source_type
)[
'name'
]
,
'view'
:
'journals'
'view'
:
'journals'
},
},
)
)
...
@@ -83,6 +87,8 @@ def docs_by_authors(request, project_id, corpus_id):
...
@@ -83,6 +87,8 @@ def docs_by_authors(request, project_id, corpus_id):
# and the project just for project.id in corpusBannerTop
# and the project just for project.id in corpusBannerTop
project
=
cache
.
Node
[
project_id
]
project
=
cache
.
Node
[
project_id
]
source_type
=
corpus
.
resources
()[
0
][
'type'
]
# rendered page : journals.html
# rendered page : journals.html
return
render
(
return
render
(
template_name
=
'pages/corpora/authors.html'
,
template_name
=
'pages/corpora/authors.html'
,
...
@@ -92,7 +98,7 @@ def docs_by_authors(request, project_id, corpus_id):
...
@@ -92,7 +98,7 @@ def docs_by_authors(request, project_id, corpus_id):
'date'
:
datetime
.
now
(),
'date'
:
datetime
.
now
(),
'project'
:
project
,
'project'
:
project
,
'corpus'
:
corpus
,
'corpus'
:
corpus
,
'resourcename'
:
get_resource
_by_name
(
corpus
.
resources
()[
0
])
,
'resourcename'
:
get_resource
(
source_type
)[
'name'
]
,
'view'
:
'authors'
'view'
:
'authors'
},
},
)
)
...
@@ -103,6 +109,9 @@ def analytics(request, project_id, corpus_id):
...
@@ -103,6 +109,9 @@ def analytics(request, project_id, corpus_id):
authorized
,
user
,
project
,
corpus
=
_get_user_project_corpus
(
request
,
project_id
,
corpus_id
)
authorized
,
user
,
project
,
corpus
=
_get_user_project_corpus
(
request
,
project_id
,
corpus_id
)
if
not
authorized
:
if
not
authorized
:
return
HttpResponseForbidden
()
return
HttpResponseForbidden
()
source_type
=
corpus
.
resources
()[
0
][
'type'
]
# response!
# response!
return
render
(
return
render
(
template_name
=
'pages/analytics/histories.html'
,
template_name
=
'pages/analytics/histories.html'
,
...
@@ -112,7 +121,7 @@ def analytics(request, project_id, corpus_id):
...
@@ -112,7 +121,7 @@ def analytics(request, project_id, corpus_id):
'date'
:
datetime
.
now
(),
'date'
:
datetime
.
now
(),
'project'
:
project
,
'project'
:
project
,
'corpus'
:
corpus
,
'corpus'
:
corpus
,
'resourcename'
:
get_resource
_by_name
(
corpus
.
resources
()[
0
])
,
'resourcename'
:
get_resource
(
source_type
)[
'name'
]
,
'view'
:
'analytics'
,
'view'
:
'analytics'
,
'user'
:
request
.
user
'user'
:
request
.
user
},
},
...
...
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