Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
f20bb997
Commit
f20bb997
authored
6 years ago
by
Erwan Rouchet
Committed by
Bastien Abadie
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Autodetect PDF imports on demo endpoint
parent
0003f0fc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex/dataimport/api.py
+6
-6
6 additions, 6 deletions
arkindex/dataimport/api.py
with
6 additions
and
6 deletions
arkindex/dataimport/api.py
+
6
−
6
View file @
f20bb997
...
...
@@ -138,7 +138,7 @@ class DataImportDemo(CorpusACLMixin, CreateAPIView):
# Get volume, defaults to demo one
volume_id
=
self
.
request
.
query_params
.
get
(
'
volume
'
)
filters
=
{
'
corpus
__in
'
:
corp
ora
,
'
corpus
'
:
datafile
.
corp
us
,
'
type
'
:
ElementType
.
Volume
,
}
if
volume_id
:
...
...
@@ -148,15 +148,15 @@ class DataImportDemo(CorpusACLMixin, CreateAPIView):
volume
=
get_object_or_404
(
Element
,
**
filters
)
assert
self
.
has_write_access
(
volume
.
corpus
),
\
'
Corpus is not writable
'
assert
self
.
has_write_access
(
volume
.
corpus
),
'
Corpus is not writable
'
import_mode
=
DataImportMode
.
PDF
if
datafile
.
content_type
==
'
application/pdf
'
else
DataImportMode
.
Images
# Start the import
dataimport
=
D
ata
Import
.
objec
ts
.
create
(
dataimport
=
d
ata
file
.
corpus
.
impor
ts
.
create
(
creator
=
self
.
request
.
user
,
corpus
=
datafile
.
corpus
,
state
=
DataImportState
.
Configured
,
mode
=
DataI
mport
M
ode
.
Images
,
mode
=
i
mport
_m
ode
,
payload
=
{
'
volume_id
'
:
str
(
volume
.
id
),
'
folder_name
'
:
'
user-{}-demo
'
.
format
(
self
.
request
.
user
.
id
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment