Re: write .csv file from a form

classic Classic list List threaded Threaded
2 messages Options
Encolpe Degoute-2 Encolpe Degoute-2
Reply | Threaded
Open this post in threaded view
|

Re: write .csv file from a form

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Francesca Pennacchioli a écrit :
| Hello,
| thanks for helping me, but it doesn't work.
| I have a from and the action is myScript.py.
| MyScript.py has just a line of code that call the external method.
| My external method should write the .csv file and bring the user back to
| a success page. It does bring back to the page, but it doesn't write the
| file.
|
| did I do something wrong?

It seems not for me. You should try to put logs to know where your
script failed with this:

from zLOG import LOG, INFO
LOG("################", INFO, 'string to trace')

The output will be in $INSTANCE/even.log file.

| Here myScritp.py:
| return context.writeFile(self,azione,coc)
|
| and myExternalMethod:
| import csv
|
| def writeCSV(self,azione,coc):
|        file = 'FormDeveloper1.csv'
|        writer = csv.writer(open(file, "w"))
|        dataformDev=['azione,coc']
|        for item in dataformDev:
|            writer.writerows(item)
|

- --
Encolpe Degoute
INGENIWEB (TM) - S.A.S 50000 Euros - RC B 438 725 632
2 cours du 14 Juillet - 78300 Poissy France - +331 300 601 41
web : www.ingeniweb.com - « les Services Web Ingénieux »
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDU7MYvFPzBBlIZMMRAgo+AJ9GEOkH+g5KMOZM5MvQZuCLaCG8rACeJZh7
5KEw9ma0a8ZVQMWAlCX647U=
=oRk+
-----END PGP SIGNATURE-----


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Encolpe DEGOUTE Encolpe DEGOUTE
Reply | Threaded
Open this post in threaded view
|

Re: write .csv file from a form

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Francesca Pennacchioli a écrit :
| Hello,
| thanks again your tip was really helpuful: I do have my file now.
|
| The problem is: I need to add a row each time a user fill the form. Now,
| everytime the file is re-write and not updated.
| I thought I could find an "append" method in the writer module, but
| there is none.
| Sorry, but I'm not a programmer and I can't find a good solution.

I think you need writerow:
http://docs.python.org/lib/node636.html

Regards,
- --
Encolpe DEGOUTE
http://encolpe.degoute.free.fr/
Logiciels libres, hockey sur glace et autres activités cérébrales
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDVizyvFPzBBlIZMMRAqQ2AJ4jO2ojcF/bCc0GoyqP/KWgHPic0wCfRRvQ
jct5Ji724FApPop9kHdqU+c=
=uaQr
-----END PGP SIGNATURE-----


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users