def file_new(request, filename):
division = 'new'
- filepath = filename.encode('utf-8')
- root_filepath = os.path.join(settings.NEW_PATH, filename.encode('utf-8'))
+ filepath = filename
+ root_filepath = os.path.join(settings.NEW_PATH, filename)
if request.POST:
form = AudiobookForm(request.POST)
if form.is_valid():
d[tag] = None
if not request.POST:
- form = AudiobookForm(d)
+ form = AudiobookForm(initial=d)
return render(request, "archive/file_new.html", locals())
audiobook.mp3_status = audiobook.ogg_status = status.WAITING
audiobook.save()
# isn't there a race here?
- audiobook.mp3_task = tasks.Mp3Task.delay(aid, publish).task_id
- audiobook.ogg_task = tasks.OggTask.delay(aid, publish).task_id
+ audiobook.mp3_task = tasks.Mp3Task.delay(request.user.id, aid, publish).task_id
+ audiobook.ogg_task = tasks.OggTask.delay(request.user.id, aid, publish).task_id
audiobook.save()
return redirect(file_managed, aid)
tags = {}
form = AudiobookForm(instance=audiobook)
+ user_can_publish = (
+ request.user.is_authenticated and
+ request.user.oauthconnection_set.filter(access=True).exists())
+
return render(request, "archive/file_managed.html", locals())