[Zope] Launching external apps to process uploads to LocalFS, possible?

J Cameron Cooper jccooper@jcameroncooper.com
Thu, 08 May 2003 14:26:59 -0500


>
>
>I'm setting up a document repository that allows people to upload files
>(Using Zope) to a LocalFS directory. 
>
>Those files then become visible through the Zope
>management interface. Is there any Zope friendly way to launch external
>Linux apps to process them once they have been uploaded? I'd like to
>translate .dvi and Word .doc files into PDF using wvWare and dvipdfm.
>
>I suppose I could use a cron job and a shell script to do the conversion
>at regular intervals, but I'd rather do it immediately. I guess what I
>am asking is if Zope's Python can be told to launch apps on the hosting
>machine.. But that seems like it would be a major security hole, so I
>understand if its not possible..
>  
>
You can't access your system with TTW code, but that which resides on 
the filesystem can do whatever it pleases.

There are two approaches:

 - only do uploads through your own scripts. These would take the 
file-like object from the request, perform the conversion on it, and 
then add it to your repository. The script itself could be an External 
Method, or (better, I think) a Python Script that calls whatever 
External Methods (or Product methods) it needs to do the conversion. 
Those external methods can use system programs through whatever os.* 
call is most appropriate to create and return the converted file.

 - convert things as above, but overwrite the PUT method on the 
repository to handle uploads. This will make it a more fundamental change.

          --jcc