|
30 | 30 | import shutil |
31 | 31 | from django.views.generic.base import TemplateView |
32 | 32 | from django.utils.decorators import method_decorator |
33 | | -from django.contrib.auth.decorators import permission_required |
| 33 | +from django.contrib.auth.decorators import permission_required, login_required |
34 | 34 | from django.conf import settings |
35 | 35 | from chunked_upload.views import ChunkedUploadView, ChunkedUploadCompleteView |
36 | 36 | from configuration.models import ( |
|
45 | 45 | class ReceptionUploadView(TemplateView): |
46 | 46 | template_name = 'api/reception_upload.html' |
47 | 47 |
|
48 | | - @method_decorator(permission_required('essarch.change_ingestqueue')) |
| 48 | + @method_decorator(login_required) |
49 | 49 | def dispatch(self, *args, **kwargs): |
50 | 50 | return super(ReceptionUploadView, self).dispatch( *args, **kwargs) |
51 | 51 |
|
@@ -91,19 +91,13 @@ def move_to_destination(self, chunked_upload, request): |
91 | 91 |
|
92 | 92 | # Create a new information package folder ready for deliver |
93 | 93 | ip_path = os.path.join( eft_path, ip_uuid) |
94 | | - print 'ippath' |
95 | | - print ip_path |
| 94 | + dest_file_path = os.path.join(ip_path, chunked_upload.filename) |
| 95 | + |
96 | 96 | if os.path.exists(ip_path): |
97 | | - print 'path exists' |
98 | | - shutil.move(tmp_file_path, ip_path) |
99 | | - print 'file moved' |
100 | | - |
| 97 | + shutil.move(tmp_file_path, dest_file_path) |
101 | 98 | else: |
102 | | - print 'path vill be created' |
103 | 99 | os.makedirs(ip_path) |
104 | | - print 'file will be moved' |
105 | | - shutil.move(tmp_file_path, ip_path) |
106 | | - print 'file moved' |
| 100 | + shutil.move(tmp_file_path, dest_file_path) |
107 | 101 |
|
108 | 102 | chunked_upload.delete(delete_file=True) |
109 | 103 |
|
|
0 commit comments