Despite what you might think, it's fairly easy to write MySQL-based Web applications with Zope. In this case study, find out how to do just that by building a Zope-based online poll which uses MySQL to store poll questions and user responses, and DTML Methods to extract and present this information.
The first task is to check if the form has been submitted. If it has not yet been submitted, then the method generates an empty form, with fields for the question and possible responses. Once the form is submitted, the data entered into the form by the administrator is inserted into the database via the "insertPoll" Z SQL Method below.
Note that the built-in ZopeTime DTML variable (which returns the current system time) has been used to insert the current date as part of the table record. This is similar to the now() function that is built into the MySQL database.
Here's what the form and its result look like:
And that's about it. Hopefully, this exercise gave you some insight into how Zope can be used to build a simple Web application, and illustrated its power and flexibility as a rapid development tool for the Web medium. See ya! Note: All examples in this article have been tested on Linux/i586 with Zope 2.5. Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article. YMMV!