[ZPT] How to write input to a file and run a perl script
Dear users, I am fairly new to zope. i am not much of a computer scientist but I can do some programming. ok so here is my problem: I have ot create a web page, which asks the user for some inputs and upload of a data file. The input values and the file name (the uploaded file will be saved on the server) are to be written to a text file that will be saved on the server. This text file will then be given as input to a perl program that will read and do some calculations. Now I have reached so far: I have created a web page which asks for user inputs. Then when the user submits the form : a) I create another web page that shows the user what all he has inputted and , b) also send the input ( thought he set parameter list) to a python script. Now I am not able to understand ??? 1) how to write all the set of parameter that python script has got onto a text file ( i do not clearly understand about the limitations of script in zope context) 2) Also how do I call a perl script from this python script. ( i could not understand the concept of external methods) Any pointers will be very helpful. Also any example of similar code will be beneficial. Thanks a lot for your time ___ ZPT mailing list ZPT@zope.org http://mail.zope.org/mailman/listinfo/zpt
Re: [ZPT] How to write input to a file and run a perl script
Charu ASTHANA schrieb: Dear users, I am fairly new to zope. i am not much of a computer scientist but I can do some programming. ok so here is my problem: I have ot create a web page, which asks the user for some inputs and upload of a data file. The input values and the file name (the uploaded file will be saved on the server) are to be written to a text file that will be saved on the server. This text file will then be given as input to a perl program that will read and do some calculations. Now I have reached so far: I have created a web page which asks for user inputs. Then when the user submits the form : a) I create another web page that shows the user what all he has inputted and , b) also send the input ( thought he set parameter list) to a python script. Now I am not able to understand ??? 1) how to write all the set of parameter that python script has got onto a text file ( i do not clearly understand about the limitations of script in zope context) Well what you edit via browser in Zope is called thru-the-web scripting and is made as secure as possible. So you _dont_ have access to the servers filesystem from there. However, you have extfile and localfs as ready to install products which enable limited filesystem access to create the objects there. Still then you would have to find a way to call that external script. 2) Also how do I call a perl script from this python script. ( i could not understand the concept of external methods) External methods are created as python source files in the extensions directory and contain at least one function. In these scripts you can do everything python enables you to do, including filesystem access and popen() for startig external tools. Any pointers will be very helpful. Also any example of similar code will be beneficial. There are a lot cerveats when it comes to such constructs. You can easily enable big security holes to your system when you arent very carefully. Thats why TTW-scripting is so isolated. Btw, what exact type of some calculations does your perl script do? I'd expect it easier to just rewrite it in pure python. Other approaches would be to provide the form in zope maybe and then just direct the action to a cgi-bin which is or calls your perl script (depending on its interface) Regards Tino ___ ZPT mailing list ZPT@zope.org http://mail.zope.org/mailman/listinfo/zpt
Re: [ZPT] How to write input to a file and run a perl script
Am 30.04.2007, 15:23 Uhr, schrieb Charu ASTHANA [EMAIL PROTECTED]: Dear users, I am fairly new to zope. i am not much of a computer scientist but I can do some programming. ok so here is my problem: I have ot create a web page, which asks the user for some inputs and upload of a data file. The input values and the file name (the uploaded file will be saved on the server) are to be written to a text file that will be saved on the server. Why do you want to save to a file rather than the Zope database? If you need access to the file system you must use an ExternalMethod. This text file will then be given as input to a perl program that will read and do some calculations. Now I have reached so far: I have created a web page which asks for user inputs. Then when the user submits the form : a) I create another web page that shows the user what all he has inputted and , b) also send the input ( thought he set parameter list) to a python script. Now I am not able to understand ??? 1) how to write all the set of parameter that python script has got onto a text file ( i do not clearly understand about the limitations of script in zope context) Look at context.REQUEST.form in the PythonScript for the values. You cannot access the file system from within a PythonScript 2) Also how do I call a perl script from this python script. ( i could not understand the concept of external methods) You cannot. How complex is the perl script? It might make sense to rewrite it in Python to be able to use it from within Zope otherwise you must use an ExternalMethod to invoke your perl script, pass it the data and get a response from it but would be fairly complicated. Any pointers will be very helpful. Also any example of similar code will be beneficial. For what you want to do it seems strange to want to use Zope rather than using a Perl cgi script. If you are going to stick with the Zope then you should probably spend some time reading the Zope Book to understand what Zope is, how it works and what it lets you do. Charlie -- Charlie Clark eGenix.com Professional Python Services directly from the Source Python/Zope Consulting and Support ...http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 ___ ZPT mailing list ZPT@zope.org http://mail.zope.org/mailman/listinfo/zpt