[Zope] Newbie question on running external method

Steve Spicklemire steve@spvi.com
Sat, 18 May 2002 07:57:20 -0500


Hi Leo,

please don't post HTML to the list.

Since the exception is a mysql exception, it might help to see the query=20=

you are actually attempting. I'm guessing that maybe there is some other=20=

difference between the method that works, and the one that fails, that=20=

affects the query you are generating with your ReadPhotoID ZSQL Method.=20=

You might try replacing your loop with:

<dtml-var "ReadPhotoID(foname=3DREQUEST.get('folder'), src__=3D1)">

this should display the query, and possibly some clues.

good luck!
-steve

On Friday, May 17, 2002, at 01:27  PM, Leo wrote:

> Hello,
> =A0
> I'm still working on my Zope site, and I have another problem again.
> =A0
> I have a MySQL table called Photos and with column names: filename,=20
> foldername, PhotoID(primary key).
> =A0
> ReadPhotoID is the ZSQL method by passing folder data and get back=20
> filename,=A0PhotoID.
> photorename is the external method to pass the foldername, filename =
and=20
> PhotoID data, and rename the file name from "filename" to "PhotoID",=20=

> eg. from "abcd.jpg" to "123.jpg".
> =A0
> photorename code is :
> =A0=A0=A0 import os
> =A0=A0=A0 def photorename(folder, filename, photoID):
> =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=20
> =
os.renames("/Finish/"+folder+"/"+filename,"/Finish/"+folder+"/"+photoID+".=
jpg"
> )
> =A0
> So, I use the following code:
> =A0
> =A0=A0=A0 <dtml-in "ReadPhotoID(foname=3DREQUEST.get('folder'))">
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <dtml-var =
"photorename(REQUEST.get('folder'),filename,=20
> PhotoID)">
> =A0=A0=A0=A0</dtml-in>
> It shows a site error with "_mysql_exceptions.NotSupportedError".
> =A0
> However, it runs ok when I just show the data:
> =A0=A0=A0 <dtml-in "ReadPhotoID(foname=3DREQUEST.get('folder'))">
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0<dtml-var filename>
> =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 <dtml-var PhotoID>
> =A0=A0=A0=A0</dtml-in>
> or put the data manually in the external method:
> =A0=A0=A0 =A0=A0=A0 <dtml-var "photorename(REQUEST.get('folder'), =
'abcd.jpg',=20
> '123')">
> Did I miss something? I worked on this problem 2 days and still cannot=20=

> find out which part is wrong. Please tell me anything wrong if you=20
> found it. Thanks in advance.
> =A0
> Leo