示例#1
0
def edit_submit_file(request, slug):
    file = get_object_or_404(POFile, slug=slug)
    redirect = HttpResponseRedirect(reverse('commit_queue'))
    if request.method == 'POST':
        if request.POST.has_key('_save'):
            form = FileEditForm(request.POST)
            if form.is_valid():
                try:
                    filehandler.handle_text_file(file, form.cleaned_data['content'], request.user, form.cleaned_data['comment'])
                    messages.info(request, message=_("The file was added back to the submission queue."))
                    return redirect
                except Exception, e:
                    res = e.message.split("$$")
                    for m in res:
                        messages.error(request, message=m[:-1])
        else:
            if file.submits.all_pending():
                s = file.submits.get_pending()
                s.enabled = True
                s.save()            
            return redirect
示例#2
0
def edit_file(request, slug):
    file = get_object_or_404(POFile, slug=slug)
    redirect = HttpResponseRedirect(reverse('list_files',
                            kwargs={'release': file.release.slug,
                              'language': file.language.code}))
    if request.method == 'POST':
        if request.POST.has_key('_save'):
            form = FileEditForm(request.POST)
            if form.is_valid():
                try:
                    filehandler.handle_text_file(file, form.cleaned_data['content'], request.user, form.cleaned_data['comment'])
                    messages.info(request, message=_("%s was added to the submission queue.") % file.filename)
                    return redirect
                except Exception, e:
                    res = str(e).split("$$")
                    for m in res:
                        messages.error(request, message=m[:-1])
                
        else:
            if file.submits.all_pending():
                s = file.submits.get_pending()
                s.enabled = True
                s.save()            
            return redirect