Some of the information here may be outdated, please check the book instead
[edit]

Geraldo uses ReportLab (&, optionally, PIL) to generate nice reports: http://geraldo.sourceforge.net/

Their examples use Django: http://geraldo.sourceforge.net/docs/tutorial-1.html

Here is an example of how to use in Web2Py:

Model (simplified): db.define_table(customer, Field('name', length=100))

db.define_table(purchase, Field('customer', db.customer))

Controller: def purchase_report(): from reports import ReportPurchase from geraldo.generators import PDFGenerator import gluon.contenttype import StringIO

    resp = StringIO.StringIO()

    purchases = db(db.purchase.id > 0).select(orderby=db.purchase.customer|db.purchase.id)
    report = ReportPurchase(queryset=purchases)
    report.generate_by(PDFGenerator, filename=resp)

    resp.seek(0)
    response.headers['Content-Type'] = gluon.contenttype.contenttype('.pdf')
    filename = "%s_Purchases.pdf" % (request.env.server_name)
    response.headers['Content-disposition'] = "attachment; filename=\"%s\"" % filename
    return resp.read()
© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.