Hallo, Bogdan hat gesagt: // Bogdan wrote: > from WebKit.Page import Page > from Cheetah.Template import Template > import MySQLdb > > tempDef=""" ... > <TABLE bgcolor="#07e1f9" width=80% align="center"> > <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() > Your Page-class needs to know about its possible (re)actions to form input. So just define an "action" and append it to the list of Page actions like:
def actions(self): return Page.actions(self) + ['addrec'] def addrec(self): # DB setup... req = self.request() filename = req.value("filename", None) if filename: cur.execute('insert into userlist values % ;' % filename) self.writeBody() ciao -- Frank Barknecht _ ______footils.org__ ------------------------------------------------------- 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