Upload files and TimeStamp format
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) >= <dtml-var "ZopeTime(p_dal + _.str(' 00:00:00.000 GMT+2'))"> and "_.DateTime(time) <= <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) <= 2003/07/21 23:59:59 GMT+2 LIMIT 1000' at li") What to do?
Christian Pizzuto wrote:
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
1. the above code should be in a python script 2. can you get nomecartella to contain "Intranet/Bandi/bando18"? If you can do these, then the line to use would be: context.restrictedTraverse(nomecartella).manage_addFile(nomefile,file,titolofile)
Another question:
It's probably best to stick with one question per email and send two mails...
select ... from ... where ... and "_.DateTime(time) >= <dtml-var "ZopeTime(p_dal + _.str(' ^^^^^^^^^^^^^^^^
This isn't valid SQL ;-) What is time? Why are you trying to use a Zope function on it? ZSQL methods are used purely to build and then execute a lump of SQL, use the ZSQL Method test tab to check what SQL you're generating... cheers, Chris
participants (2)
-
Chris Withers -
Christian Pizzuto