[Zope] Upload files and TimeStamp format
Christian Pizzuto
c.pizzuto@ial.abruzzo.it
Mon, 21 Jul 2003 14:14:04 +0200
This is a multi-part message in MIME format.
------=_NextPart_000_0076_01C34F92.57440180
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I've posted my problem in Italian Forum and had no answer.
I'm newbie in zope and python, and I made a form for uploading files =
into Zope folders. The problem is that the name of the folder in which =
uploading the file, is in a variable called "nomecartella" and is like =
"Intranet.Bandi.bando18". The code I used is:
<dtml-call "_[nomecartella].manage_addFile(nomefile, file, titolofile)">
where
nomecartella is the variable that contains the path of the folder that I =
want contains the uploaded file;
nomefile is the id of the file I want upload;
titolofile is the name of the file.
But I get an error:
Error Type: KeyError
Error Value: Intranet.Bandi.bando18
If I replace _[nomecartella] with Intranet.Bandi.bando18 it works !!!!
Any ideas?
Another question:
I've a set of records in a MySQL DB having a TimeStamp field. I made a =
SQL method for retrieving all the records between two dates typed in by =
the user ( in format %d/%m/%Y).
I used this code:
select ... from ... where ...
and "_.DateTime(time) >=3D <dtml-var "ZopeTime(p_dal + _.str(' =
00:00:00.000 GMT+2'))">
and "_.DateTime(time) <=3D <dtml-var "ZopeTime(p_al + _.str(' =
23:59:59.000 GMT+2'))">
where
time is the TimeStamp field into the DB;
p_dal and p_al are the two dates that make my range.
I get this error:
Error Type: ProgrammingError
Error Value: (1064, "You have an error in your SQL syntax. Check the =
manual that corresponds to your MySQL server version for the right =
syntax to use near '_.DateTime(time) <=3D 2003/07/21 23:59:59 GMT+2 =
LIMIT 1000' at li")
What to do?
------=_NextPart_000_0076_01C34F92.57440180
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I've posted my problem in Italian Forum =
and had no=20
answer.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm newbie in zope and python, and I =
made a form=20
for uploading files into Zope folders. The problem is that the name of =
the=20
folder in which uploading the file, is in a variable called =
"nomecartella" and=20
is like "<STRONG>Intranet.Bandi.bando18</STRONG>". The code I used=20
is:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><dtml-call=20
"_[nomecartella].manage_addFile(nomefile, file,=20
titolofile)"><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>where</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><EM>nomecartella</EM> is the variable =
that contains=20
the path of the folder that I want contains the uploaded =
file;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><EM>nomefile</EM> is the id of the =
file I want=20
upload;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><EM>titolofile</EM> is the name of the=20
file.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>
<DIV><FONT face=3DArial size=3D2>But I get an error:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><STRONG>Error Type: KeyError<BR>Error Value:=20
Intranet.Bandi.bando18</STRONG></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG></STRONG></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>If I replace _[nomecartella] =
with <FONT face=3D"Times New Roman" size=3D3>Intranet.Bandi.bando18 =
it works=20
!!!!</FONT></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Any ideas?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Another question:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I've a set of records in a MySQL DB =
having a=20
TimeStamp field. I made a SQL method for retrieving all the =
records=20
between two dates typed in by the user ( in format =
%d/%m/%Y).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I used this code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>
<DIV><FONT face=3DArial size=3D2>select ... from ... where =
...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>and "_.DateTime(time) >=3D =
<dtml-var=20
"ZopeTime(p_dal + _.str(' 00:00:00.000 GMT+2'))"><BR>and=20
"_.DateTime(time) <=3D <dtml-var "ZopeTime(p_al + _.str(' =
23:59:59.000=20
GMT+2'))"></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>where</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>
<DIV><FONT face=3DArial size=3D2><EM>time</EM> is the =
TimeStamp=20
field into the DB;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><EM>p_dal</EM> and <EM>p_al</EM> =
are the two=20
dates that make my range.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I get this error:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><STRONG>Error Type: ProgrammingError<BR>Error Value: (1064, "You =
have an=20
error in your SQL syntax. Check the manual that corresponds to your =
MySQL server=20
version for the right syntax to use near '_.DateTime(time) <=3D =
2003/07/21=20
23:59:59 GMT+2 LIMIT 1000' at li")</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV>What to do?</DIV></DIV></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></DIV>
<DIV><FONT face=3DArial size=3D2> </DIV></FONT></BODY></HTML>
------=_NextPart_000_0076_01C34F92.57440180--