I have Webaware 0.7 running on Apache 1.3.26 on Debian linux. I'm a
newbie in python and webware, and it is difficult for me to browse the
sources, so can somebody give me an example and/or advice about how to
handle forms. Here is my code:

from WebKit.Page import Page
from Cheetah.Template import Template
import MySQLdb

tempDef="""
<TABLE bgcolor="#07e1f9" width=80% align="center">
#for $i in $row
    <tr>
    #for $k in $i
        <td>$k</td>
    #end for
    </tr>
#end for
</table>
<BR>
<form action="index.py" method=POST enctype="multipart/form-data">
<input type="text" name="filename"><BR>
<input type="SUBMIT" name="_action_" value="addrec">
</form>
</body></html>
"""

class index(Page):
    def __init__(self):
        Page.__init__(self)
        self.compTemplate = Template(tempDef)
    def title(self):
        return "Test!"
        
    def writeContent(self):
        conn=MySQLdb.connect(db="test", user="root")
        cur=conn.cursor()
        cur.execute("""SELECT * from userlist;""")
        t = self.compTemplate
        t.row = cur.fetchall()
        self.writeln(t)
        cur.close()
        conn.close()
        



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to