[Grok-dev] Get files

Steve Schmechel steveschmechel at yahoo.com
Tue Mar 23 08:45:19 EDT 2010


--- On Sun, 3/21/10, zavi <osishkin at gmail.com> wrote:

> From: zavi <osishkin at gmail.com>
> Subject: Re: [Grok-dev] Get files
> To: grok-dev at zope.org
> Date: Sunday, March 21, 2010, 8:24 AM
> 
> Thank you everyone for the very quick and detailed
> responses.
> 
> Some follow-up questions - 
> 1. If I want to use the zope.file.download, I see here
> http://svn.zope.org/zope.file/branches/ajung-blobs/src/zope/file/download.py?rev=72831&view=markup
> That it is related to a browser view. Which means I have to
> access my grok
> application using a browser, which pops up a dialog for
> downloading the file
> etc.
> Is there a way to bypass that, by having the client send a
> REST request with
> the file name and get it directly? 
> I need to have grok display pages, but not always for the
> particaulr task of
> sending files to the client.

I am not exactly sure of your requirements, but the simple answer seems
just too obvious:  If you want a program that returns a file when given
an HTTP GET request, you just described a web server, not a web
application.  As you are running with Apache/mod_wsgi, wouldn't the
easiest an fasted way to accomplish this be to write some mod_rewrite
rules that deliver the files directly from Apache?  

> 
> 2. Can I improve performance using sendfile()? is this
> integrated (or can be
> integrated) to Grok in some way?
> For example I managed to write a simple (non-grok)
> application that uses
> mod_wsgi directly to work with x-sendfile. Maybe this is
> possible somehow
> with grok?
> I see there's a sendfile patch for zope2
> http://gabbpuy.blogspot.com/2007/03/sendfile-patch-for-zope2.html
> Can this perhaps be integrated to grok?

Again, something like this might be a quick fix to a performance issue
for an existing application that was originally serving the static
content itself, but I don't think I would start a new web application
this way.

It would be too easy to misuse it and start poking holes all over the
place where much of the application is bypassed, resulting in security
issues, difficult testing, and logs that are hard to decipher.

This, of course, is just my opinion base on the little I know about what
you are trying to accomplish.  You may have good reason for doing
otherwise.

Regards,
Steve



      


More information about the Grok-dev mailing list