Reports, PDF, and grid widget for Python?

John Hunter jdhunter at ace.bsd.uchicago.edu
Tue Oct 22 10:07:52 EDT 2002


>>>>> "Adams-Blake" == Adams-Blake Co <aremovethiscanton at adamsremovethis-blake.com> writes:

    Adams-Blake> Cameron Laird wrote: ------------------------

    Adams-Blake> We're too small to have our own co-lo Internet
    Adams-Blake> server, so we will have to be hosted. How many Zope
    Adams-Blake> or JSP host ISPs are there?


There are 89 companies which provide 'professional Zope services'
listed on the zope.org page:  http://www.zope.org/Resources/ZSP

Or search google for zope hosting:

  http://www.nipltd.net
  http://www.freezope.org 
  http://zettai.net

and more....

    Adams-Blake> As for reporting needs, I don't want to pay a guy $60
    Adams-Blake> an hour for 24 hours times 50 reports to do
    Adams-Blake> down-and-dirty X,Y co-ordinate Python scripting in
    Adams-Blake> ReportLab when the same guy using something like
    Adams-Blake> Datavision with Java (or Crystal) can turn out the
    Adams-Blake> same report in 6 or 8 hours.

    Adams-Blake> I figure that the time to put up the web screens as
    Adams-Blake> well as the business logic will be about the same no
    Adams-Blake> matter what language or platform we use...  but I
    Adams-Blake> like Python because it is so clean-looking and its
    Adams-Blake> ability to prototype. And database is database
    Adams-Blake> (MySql). The one big problem we have is
    Adams-Blake> reporting... and as this is a BUSINESS SYSTEM reports
    Adams-Blake> (via PDF) are a major selling point.

You may want to take a look at the htmldoc utility.  This (among other
things) converts html to PDF.  I have been impressed with the quality
of pdf generation.  If you stop by a bookstore, take a look at The
Zope Book (Latteier & Pelletier).  The entire book was generated using
htmldoc, and is a high quality publication.  So one option you have is
generating your reports in html or structured text in zope, and
converting them to pdf using htmldoc.  You would probably have to pay
some attention to generating html that htmldoc handles well, but this
might get you up and running, until you or someone else wraps
reportlab's functionality into a form usable by you.  Or it might
serve all your needs.

Here is a simple hand crafted html table:

<html>
  <head></head>
  <body bgcolor="#FFFFFF">
    <h2>A simple table</h2>
    <table width="100%" border=1 cellpadding=1 cellspacing=0 valign="top">
      <tr><th>Last</th><th>First</th><th>Age</th><th>Phone</th></tr>
      <tr><td>Hunter</td><td>John</td><td>33</td><td>773-955-7822</td></tr>
      <tr><td>Smith</td><td>Sam</td><td>21</td><td>312-222-9999</td></tr>
      <tr><td>Williams</td><td>Will</td><td>99</td><td>201-555-1212</td>></tr>
    </table>
  </body>
</html>

Which I converted to PDF with htmldoc using the default options.  By
altering the table parameters in html, I suspect you could generate a
more or less professional quality report --
http://nitace.bsd.uchicago.edu:8080/summer/jdh/test.pdf

Database connectivity is well supported in zope.  You could generate
the above in DTML with something like (off the cuff here so forgive
errors)

<dtml-var standard_pdf_header>
  <h2>A simple table</h2>
  <table <dtml-var report_table_params> >
    <tr><th>Last</th><th>First</th><th>Age</th><th>Phone</th></tr>
      <dtml-in get_customers_sql>
      <tr>
        <td><dtml-var last></td>
        <td><dtml-var first></td>
        <td><dtml-var age></td>
        <td><dtml-var phone></td>
      </tr>
     <dtml-in>
  </table>
<dtml-var standard_pdf_footer>

where last, first, age and phone are mysql column headers, which are
automagically brought into the zope namespace variables by the mysql
call.  The standard_pdf_header and report_table_params are
customizable parameters to give your reports a consistent (and easily
alterable) look and feel.

Or, if you prefer to work exclusively in python (or perl) and generate
your html there, you can.  Or you can design the front end in a
WYSIWYG editor and use zope page templates to code the logic.  It's a
powerful system.

John Hunter




More information about the Python-list mailing list