Commit e6976aeb authored by c24b's avatar c24b

[UPLOAD]: catching OsERROR from upload limit and managing view

parent 5866a043
......@@ -246,8 +246,7 @@ from .settings import BASE_DIR
# uploads/.gitignore prevents corpora indexing
# copora can be either a folder or symlink towards specific partition
UPLOAD_DIRECTORY = os.path.join(BASE_DIR, 'uploads/corpora')
UPLOAD_LIMIT = 1024
#* 1024 * 1024
UPLOAD_LIMIT = 1024* 1024 * 1024
DOWNLOAD_DIRECTORY = UPLOAD_DIRECTORY
......
......@@ -95,10 +95,22 @@ def project(request, project_id):
name = request.POST['name'],
typename = 'CORPUS',
)
corpus.add_resource(
type = int(request.POST['type']),
path = upload(request.FILES['file']),
try:
corpus.add_resource(
type = int(request.POST['type']),
path = upload(request.FILES['file']),
)
except OSError:
#file upload limit in files.py
return render(
template_name = 'pages/projects/wait.html',
request = request,
context = {
'user' : request.user,
'project': project,
},
)
session.add(corpus)
session.commit()
......
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