Thanks Mike!
FileApp and forward did the trick. I ended up storing my user-
uploaded files in a subdirectory ("files") of my Pylons project root
directory. And I added my own authentication decorators to both the
view() and retrieve() actions of FileController so that
unauthenticated guests cannot access the files.
My one reservation is that I don't really understand the routes
configuration that you suggested:
# Route
map.connect("file", "/my_url/{path:.*}", controller="mycontroller",
action="my_action")
But that's understandable seeing as I haven't yet learned more than
the basics of the Routes system.
I ended up using the following, which seems to work fine for my
purposes (I guess because I am storing all my files in the "files"
directory without any subdirectories):
# Route
map.connect('/file/retrieve/{path}', controller='file',
action='retrieve')
And I reference my files from within my Mako templates via:
${h.url_for(controller='file', action='retrieve', path=fileName)}
Thanks again for the help,
Joel
On Mar 7, 9:47 pm, Mike Orr <[email protected]> wrote:
> On Sun, Mar 7, 2010 at 9:42 PM, Mike Orr <[email protected]> wrote:
> > def my_action(self, path, environ, start_response):
>
> Ignore the last two arguments. They were needed in older versions of
> Pylons before the 'forward' utility existed.
>
> --
> Mike Orr <[email protected]>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.