By using reportlab in a system and send a variable from one function
to another to generate the report I get the following error, but only
in the latest version of web2py (1.71.2), I hope you can help me.
this is my code:
def reportePais():
form=FORM(TABLE(TR("Seleccione un PaĆs",SELECT
(_type="select",_name="pais", *[OPTION(x.nPais,_value=x.id)
for x in db().select(db.Pais.ALL, orderby = db.Pais.nPais)])),
TR("", INPUT(_type='submit',_value='Generar Reporte'))))
if form.accepts(request.vars, session):
return reportePaisResult(form.vars.pais)
return dict(form=form)
def reportePaisResult(x):
P=Paragraph("Productos seleccionados" ,h1); story.append(P);
story.append(Spacer(0,12))
consulta=db(db.Inventario.idPais==x).select()
if not len(consulta):
redirect(URL(r=request))
P=Paragraph("Cuerpo del reporte",h1); story.append(P)
cab=[['#id'],['Id Pais']]
m=[[x.id for x in consulta],[x.idPais for x in consulta]]
mcab=[cab[x]+m[x] for x in range(len(cab))];mcab=map
(None,*mcab);t=Table(mcab);t.setStyle(EstiloTablaH)
story.append(t)
story.append(Spacer(0,10))
doc=SimpleDocTemplate("Reporte.pdf",pagesize=landscape
(A4),showBoundary=1); doc.build(story)
response.headers['Content-Type']='application/pdf'
response.headers['Content-Disposition'] =
'attachment;filename=Reporte.pdf'
return response.stream(open("Reporte.pdf", 'rb'))
it generates the next error
TypeError: 'NoneType' object is not callable
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---