Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Experience varies directly with equipment ruined.


devel / comp.lang.python / Re: always return the same pdf

SubjectAuthor
o Re: always return the same pdfMRAB

1
Re: always return the same pdf

<mailman.242.1646680254.2329.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17432&group=comp.lang.python#17432

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: pyt...@mrabarnett.plus.com (MRAB)
Newsgroups: comp.lang.python
Subject: Re: always return the same pdf
Date: Mon, 7 Mar 2022 19:10:49 +0000
Lines: 37
Message-ID: <mailman.242.1646680254.2329.python-list@python.org>
References: <CAF40P_2izcWE6bEMr7F_KUFJV7XxpG+otfqmo67JKCJfCchvvg@mail.gmail.com>
<313427bd-3ded-53ca-8a2c-631f3adee907@mrabarnett.plus.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de Jbd05DpP9DD9E0ScisYIqQaXKmWTegtNfan95XDIQAMA==
Return-Path: <python@mrabarnett.plus.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=plus.com header.i=@plus.com header.b=IHVUUX1l;
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'skip:@ 10': 0.03; 'def':
0.04; 'django': 0.07; 'string': 0.07; 'everyone.': 0.09;
'from:addr:python': 0.09; 'received:192.168.1.64': 0.09; 'ubuntu':
0.09; '18.04': 0.16; 'cosas': 0.16;
'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16;
'generates': 0.16; 'generating': 0.16; 'latex': 0.16; 'message-
id:@mrabarnett.plus.com': 0.16; 'pdf.': 0.16; 'received:plus.net':
0.16; 'subject:always': 0.16; 'subject:pdf': 0.16; 'wrote:': 0.16;
'it?': 0.19; 'to:addr:python-list': 0.20; 'idea': 0.24; 'header
:User-Agent:1': 0.30; 'think': 0.32; 'everyone': 0.32;
'received:192.168.1': 0.32; 'but': 0.32; 'server': 0.33; 'same':
0.34; 'header:In-Reply-To:1': 0.34; 'pdf': 0.36; 'using': 0.37;
'received:192.168': 0.37; 'file': 0.38; 'could': 0.38; 'thanks':
0.38; 'view': 0.60; 'gives': 0.62; 'received:212': 0.62; 'skip:o
20': 0.63; 'simply': 0.63; 'con': 0.64; 'skip:f 20': 0.75; 'que':
0.84; 'pointing': 0.84; 'bien': 0.91; 'sin': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019;
t=1646680252; bh=xsIlB3WNTiHCpFwz2u4BkYvSiNUsZKKX8t0fdhPOCa8=;
h=Date:Subject:To:References:From:In-Reply-To;
b=IHVUUX1lXJjQRoq0V8NLLmDdBntsTLfi40wpRggT3xR4sKBdn+VZtiuA+Z9jUwcr3
WFc9eQCsrctUHVSj9R3NBTeN+rcyB7wJj8g6FzWhMLwdI6+8TDLh9lMqPKNIcIG0qZ
kMO6WKwl2EleorRlsCC5IIME7Sl5sKbDv4m8prfA+u2/2ZGuzIrAIU6ZrFTFmBSxRZ
JdYJbnYr4fiBY9c99FUfo/E05IXvjg55GY2zHZSX2pXboIkGs2lWNa+8CuPWXhdMj2
djG+95gailZBXmhOUMblVEIcIf8yQZ5XmWVc98GJtYbktj9RGBga7I2uizuDNr2eYx
xGpQUgifj7BYw==
X-Clacks-Overhead: "GNU Terry Pratchett"
X-CM-Score: 0.00
X-CNFS-Analysis: v=2.4 cv=AKknf/Zy c=1 sm=1 tr=0 ts=622658bc
a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17
a=IkcTkHD0fZMA:10 a=rkLDJ6zgAxmgDd4QYVcA:9 a=QEXdDO2ut3YA:10
X-AUTH: mrabarnett@:2500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.6.2
Content-Language: en-GB
In-Reply-To: <CAF40P_2izcWE6bEMr7F_KUFJV7XxpG+otfqmo67JKCJfCchvvg@mail.gmail.com>
X-CMAE-Envelope: MS4xfG2K8i/CdbEsKvKyojQ1f6Qc00mG+DBbO5vxzda5qW7r32JukF7LkyB11w78cta6mVrfJ62+X+lhd37JzytICsnrf6ljjA0sYHghtHyU+w95BWuVWkaV
zqKSO85XDRXO8Pt06E2XX/n5+Rz0UDTAkGF0jtwd9V2BjmvLp/3huU32R/evb3scsgCXfqErRe2HCJ4VdLjxsUeFflCKEcZJyQg=
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <313427bd-3ded-53ca-8a2c-631f3adee907@mrabarnett.plus.com>
X-Mailman-Original-References: <CAF40P_2izcWE6bEMr7F_KUFJV7XxpG+otfqmo67JKCJfCchvvg@mail.gmail.com>
 by: MRAB - Mon, 7 Mar 2022 19:10 UTC

On 2022-03-07 14:08, Gonzalo V wrote:
> Hello everyone.
> i had upload a Django app to an ubuntu 18.04 server and it gives me the
> same pdf everytime the view is called. To generate the pdf it receipts
> differents string buy it gives me the same pdf. Could you give some idea
> what is happening?
>
> thanks everyone
> @never_cached
> def generar_pdf(request):
> prueba = request.session.get('contenedor')
> cantidad_preguntas=prueba['cantidad_preguntas']
> archivo_salida = open("prueba.tex","w")
>
> archivo_salida.write("\\documentclass[10pt,oneside,letterpaper]{article}")
> archivo_salida.write("\\usepackage[utf8x]{inputenc}")
>
> ##hace mas y mas cosas sin importancia con latex que funcionan bien
>
> archivo_a_descargar = open("prueba.pdf","rb") #
> respuesta =
> HttpResponse(archivo_a_descargar,content_type='application/pdf')
> respuesta['Content-Disposition'] = 'attachment; filename="{0}"'.format(
> archivo_a_descargar.name)
>
> return respuesta
> Saludos,
> Gonzalo

You're using relative paths. Are you sure that they are pointing to the
correct files?

Is it actually generating the PDF?

You might think that when it generates the PDF it overwrites any
existing file of that name but is it? Is it simply giving you the PDF
that's already there?

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor