At 11:37 am -0500 8/10/99, Joshi, Sunit wrote:
Could someone please tell me, what would be the best way to pass in the query- result of a ZSQL method to a python method.
thanks Sunit
Here's what I do; def get_file(self, filenumber, RESPONSE): ''' nothing yet ''' # get the directory dir = self.savedir # get data from database res_data = self.Actors.SQL_Upload.res_data_from_filenumber(filenumber=filenumber) if len(res_data) != 1: return "Error: no data matched filenumber:%s" %filenumber resdata = res_data[0] # get the mimetype if resdata['mimetype'] == 'not known': # get some mimetypes atype = mimetypes.guess_type(resdata['filename']) if atype[0] != None: resdata['mimetype'] = atype[0] etc etc etc (I'm importing mimetypes and other stuff). It's not optimal, because it doesn't loop over the returned records, but it works! :) The SQL method is in res_data_from_filenumber (which is in a folder called SQL_Upload in a folder called Actors). It's passed the filenumber. The ZSQL method looks like this; select * from res_data where filenumber = <dtml-sqlvar filenumber type=int> (parameter filenumber:int) The database schema looks like; CREATE TABLE res_data ( filename varchar(255), filenumber int(11) DEFAULT '0' NOT NULL auto_increment, identifier varchar(20), identifier_type varchar(40), keywords varchar(255), extra_info varchar(255), user varchar(40), mimetype varchar(40), uploaded timestamp(14), filesize int(11), display varchar(4) DEFAULT 'y', PRIMARY KEY (filenumber) ); Hope this helps, tone. ------ Dr Tony McDonald, FMCC, Networked Learning Environments Project http://nle.ncl.ac.uk/ The Medical School, Newcastle University Tel: +44 191 222 5888 Fingerprint: 3450 876D FA41 B926 D3DD F8C3 F2D0 C3B9 8B38 18A2