X-Git-Url: https://git.mdrn.pl/audio.git/blobdiff_plain/2d1d955bb3b4a5ca4dad1153c062c9ab3b6319e7..6a220b0ed7d874876b6a64c9e297af2da0d303de:/apps/archive/views.py diff --git a/apps/archive/views.py b/apps/archive/views.py index 54bb28f..3ee87cb 100644 --- a/apps/archive/views.py +++ b/apps/archive/views.py @@ -27,7 +27,7 @@ def list_new(request): def file_new(request, filename): division = 'new' - filepath = os.path.join(settings.NEW_PATH, filename) + filepath = os.path.join(settings.NEW_PATH, filename.encode('utf-8')) if request.POST: form = AudiobookForm(request.POST) if form.is_valid(): @@ -53,7 +53,6 @@ def file_new(request, filename): d[tag] = models.Project.objects.get(name=d[tag]).pk except models.Project.DoesNotExist: d[tag] = None - print d if not request.POST: form = AudiobookForm(d) @@ -64,10 +63,11 @@ def file_new(request, filename): def move_to_archive(request, filename): """ move a new file to the unmanaged files dir """ - old_path = os.path.join(settings.NEW_PATH, filename) + filename_str = filename.encode('utf-8') + old_path = os.path.join(settings.NEW_PATH, filename_str) if not os.path.isdir(settings.UNMANAGED_PATH): os.makedirs(settings.UNMANAGED_PATH) - new_path = os.path.join(settings.UNMANAGED_PATH, filename) + new_path = os.path.join(settings.UNMANAGED_PATH, filename_str) if not os.path.isfile(old_path): raise Http404 @@ -87,10 +87,11 @@ def move_to_archive(request, filename): def move_to_new(request, filename): """ move a unmanaged file to new files dir """ - old_path = os.path.join(settings.UNMANAGED_PATH, filename) + filename_str = filename.encode('utf-8') + old_path = os.path.join(settings.UNMANAGED_PATH, filename_str) if not os.path.isdir(settings.NEW_PATH): os.makedirs(settings.NEW_PATH) - new_path = os.path.join(settings.NEW_PATH, filename) + new_path = os.path.join(settings.NEW_PATH, filename_str) if not os.path.isfile(old_path): raise Http404 @@ -164,7 +165,7 @@ def list_unmanaged(request): def file_unmanaged(request, filename): division = 'unmanaged' - tags = mutagen.File(os.path.join(settings.UNMANAGED_PATH, filename)) + tags = mutagen.File(os.path.join(settings.UNMANAGED_PATH, filename.encode('utf-8'))) err_exists = request.GET.get('exists') return render(request, "archive/file_unmanaged.html", locals())