示例#1
0
def receiveInput(request, xsl):
    ConvForm = ConversionForm(request.POST, request.FILES)
    if ConvForm.is_valid():
        conv = Conversion(xsl=xsl,
                          upload=ConvForm.cleaned_data['upload'],
                          url=ConvForm.cleaned_data['url'])
        conv.save(force_insert=True)

        # start the work in the background
        bg = DoWork(conv)
        bg.start()
        # give it a second, so we might skip the
        # waiting-page for quick transforms
        sleep(2)
        return HttpResponseRedirect(APPURL + '%s/result/%s' % (xsl, conv.pk))
    else:
        return HttpResponseRedirect(APPURL + '%s/' % xsl)