Exemple #1
0
 def clean(self):
     self.cleaned_data['cust'] = self.customizations
     self.cleaned_data['path'] = get_customized_pdf_path(self.book,
         self.cleaned_data['cust'])
     if not WaitedFile.can_order(self.cleaned_data['path']):
         raise ValidationError(_('Queue is full. Please try again later.'))
     return self.cleaned_data
Exemple #2
0
 def clean(self):
     self.cleaned_data['cust'] = self.customizations
     self.cleaned_data['path'] = get_customized_pdf_path(
         self.book, self.cleaned_data['cust'])
     if not WaitedFile.can_order(self.cleaned_data['path']):
         raise ValidationError(_('Queue is full. Please try again later.'))
     return self.cleaned_data
Exemple #3
0
 def save(self, *args, **kwargs):
     if not self.cleaned_data["cust"] and self.book.pdf_file:
         # Don't build with default options, just redirect to the standard file.
         return {"redirect": self.book.pdf_file.url}
     url = WaitedFile.order(
         self.cleaned_data["path"],
         lambda p, waiter_id: build_custom_pdf.delay(self.book.id, self.cleaned_data["cust"], p, waiter_id),
         self.book.pretty_title(),
     )
     return {"redirect": url}
Exemple #4
0
 def save(self, *args, **kwargs):
     if not self.cleaned_data['cust'] and self.book.pdf_file:
         # Don't build with default options, just redirect to the standard file.
         return {"redirect": self.book.pdf_file.url}
     url = WaitedFile.order(
         self.cleaned_data['path'],
         lambda p, waiter_id: build_custom_pdf.delay(self.book.id, self.cleaned_data['cust'], p, waiter_id),
         self.book.pretty_title()
     )
     return {"redirect": url}
Exemple #5
0
def wait(request, path):
    if WaitedFile.exists(path):
        file_url = join(WAITER_URL, path)
    else:
        file_url = ""
        waiting = get_object_or_404(WaitedFile, path=path)

    if request.is_ajax():
        return HttpResponse(file_url)
    else:
        return render(request, "waiter/wait.html", locals())
Exemple #6
0
 def save(self, *args, **kwargs):
     if not self.cleaned_data['cust'] and self.book.pdf_file:
         # Don't build with default options, just redirect to the standard file.
         return {"redirect": self.book.pdf_file.url}
     url = WaitedFile.order(self.cleaned_data['path'],
         lambda p: build_custom_pdf.delay(self.book.id,
             self.cleaned_data['cust'], p),
         self.book.pretty_title()
         )
     #return redirect(url)
     return {"redirect": url}
Exemple #7
0
def wait(request, path):
    if WaitedFile.exists(path):
        file_url = join(WAITER_URL, path)
    else:
        file_url = ""
        waiting = get_object_or_404(WaitedFile, path=path)
        if waiting.is_stale():
            waiting = None

    if request.is_ajax():
        return HttpResponse(file_url)
    else:
        return render(request, "waiter/wait.html", locals())
Exemple #8
0
def wait(request, path):
    if WaitedFile.exists(path):
        file_url = join(WAITER_URL, path)
        waiting = None
    else:
        file_url = None
        waiting = get_object_or_404(WaitedFile, path=path)

    if request.is_ajax():
        return HttpResponse(file_url)
    else:
        return render(request, "waiter/wait.html", {
            'waiting': waiting,
            'file_url': file_url,
        })