[Zope] Newbie question on running external method
Leo
leochan@underwriting.ca
Fri, 17 May 2002 11:27:31 -0700
This is a multi-part message in MIME format.
--Boundary_(ID_99xd818h9JhoHma46yaELA)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 7BIT
Hello,
I'm still working on my Zope site, and I have another problem again.
I have a MySQL table called Photos and with column names: filename, foldername, PhotoID(primary key).
ReadPhotoID is the ZSQL method by passing folder data and get back filename, PhotoID.
photorename is the external method to pass the foldername, filename and PhotoID data, and rename the file name from "filename" to "PhotoID", eg. from "abcd.jpg" to "123.jpg".
photorename code is :
import os
def photorename(folder, filename, photoID):
os.renames("/Finish/"+folder+"/"+filename,"/Finish/"+folder+"/"+photoID+".jpg")
So, I use the following code:
<dtml-in "ReadPhotoID(foname=REQUEST.get('folder'))">
<dtml-var "photorename(REQUEST.get('folder'),filename, PhotoID)">
</dtml-in>
It shows a site error with "_mysql_exceptions.NotSupportedError".
However, it runs ok when I just show the data:
<dtml-in "ReadPhotoID(foname=REQUEST.get('folder'))">
<dtml-var filename>
<dtml-var PhotoID>
</dtml-in>
or put the data manually in the external method:
<dtml-var "photorename(REQUEST.get('folder'), 'abcd.jpg', '123')">
Did I miss something? I worked on this problem 2 days and still cannot find out which part is wrong. Please tell me anything wrong if you found it. Thanks in advance.
Leo
--Boundary_(ID_99xd818h9JhoHma46yaELA)
Content-type: text/html; charset=iso-8859-1
Content-transfer-encoding: 7BIT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2715.400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I'm still working on my Zope site, and I have
another problem again.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have a MySQL table called Photos and with column
names: filename, foldername, PhotoID(primary key).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>ReadPhotoID is the ZSQL method by passing folder
data and get back filename, PhotoID.</FONT></DIV>
<DIV><FONT face=Arial size=2>photorename is the external method to pass the
foldername, filename and PhotoID data, and rename the file name from "filename"
to "PhotoID", eg. from "abcd.jpg" to "123.jpg".</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>photorename code is :</FONT></DIV>
<DIV><FONT face=Arial size=2> import os</FONT></DIV>
<DIV><FONT face=Arial size=2> def photorename(folder,
filename, photoID):</FONT></DIV>
<DIV><FONT face=Arial size=2>
os.renames("/Finish/"+folder+"/"+filename,"/Finish/"+folder+"/"+photoID+".jpg")</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>So, I use the following code:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> <dtml-in
"ReadPhotoID(foname=REQUEST.get('folder'))"><BR>
<dtml-var "photorename(REQUEST.get('folder'),filename,
PhotoID)"><BR> </dtml-in><BR></FONT></DIV>
<DIV><FONT face=Arial size=2>It shows a site error with
"_mysql_exceptions.NotSupportedError".</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>However, it runs ok when I just show the
data:</FONT></DIV>
<DIV><FONT face=Arial size=2> <dtml-in
"ReadPhotoID(foname=REQUEST.get('folder'))"><BR> <dtml-var
filename></FONT></DIV>
<DIV><FONT face=Arial size=2>
<dtml-var
PhotoID><BR> </dtml-in></FONT></DIV>
<DIV><FONT face=Arial size=2>or put the data manually in the external
method:</FONT></DIV>
<DIV><FONT face=Arial size=2> <dtml-var
"photorename(REQUEST.get('folder'), 'abcd.jpg', '123')"><BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Did I miss something? I worked on this problem 2
days and still cannot find out which part is wrong. Please tell me anything
wrong if you found it. Thanks in advance.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Leo</DIV></FONT></BODY></HTML>
--Boundary_(ID_99xd818h9JhoHma46yaELA)--