Converting Perl Web Report to Python

pmcgover at gmail.com pmcgover at gmail.com
Sat Sep 23 09:04:16 EDT 2006


I enjoyed Paul Barry's September article in Linux Journal entitled,
"Web Reporting with MySQL, CSS and Perl".  It provides a simple,
elegant way to use HTML to display database content without any sql
markup in the cgi script.  The cgi script simply calls the Mysql
command line with the HTML option (-H) and the SQL script file directed
to that command.  This provides complete separation of the markup from
the sql code.  The plain vanila HTML output can be spruced up with CSS
to provide more color and size control of the HTML.

Could this script be easily converted to Python?  How would you execute
the Msql command line and direct the output to a variable for display
in the cgi script?  Would it be possible to easily enhance this script
by allowing the user to pass in an SQL query parameter to the sql
script?  I attempted this in Perl by substituting the string "p_1" in
the where clause of the sql code but I could not substitute this string
with the value in the cgi code (ie. $query =~ s/p_1/value_variable/;).
Perhaps it would be easier in Python?

Also, would the user supplied parameter be a security issue?
Thanks!

Below is a link to the article:
http://delivery.acm.org/10.1145/1160000/1152907/8281.html?key1=1152907&key2=9804109511&coll=ACM&dl=ACM&CFID=15151515&CFTOKEN=6184618




More information about the Python-list mailing list