This is from an older application that I did, might need to be looked over
for 0.9.6.2 compatibility:
def download(self, environ, start_response):
if not request.environ.has_key('REMOTE_USER'):
return redirect_to(controller = '/login/ldap')
else:
fapp = fileapp.FileApp(session['fileStore'] +
request.environ['wsgiorg.routing_args'][1]['id'])
return fapp(request.environ, self.start_response)
On Tue, Jun 24, 2008 at 11:18 PM, Jonathan Vanasco <[EMAIL PROTECTED]>
wrote:
>
> disclaimer - i'm no authority on pylons.
>
> the stock error controller (automagically generated) handles the magic
> error pages
>
> it has this in there:
>
> def img(self, id):
> """Serve Pylons' stock images"""
> return self._serve_file(os.path.join(media_path, 'img', id))
>
> def style(self, id):
> """Serve Pylons' stock stylesheets"""
> return self._serve_file(os.path.join(media_path, 'style', id))
>
> def _serve_file(self, path):
> """Call Paste's FileApp (a WSGI application) to serve the file
> at the specified path
> """
> fapp = paste.fileapp.FileApp(path)
> return fapp(request.environ, self.start_response)
>
>
> there might be something else that handles it in a one liner for
> you... otherwise you may need to create a new function
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---