You get invalid requests if the url is wrong or contains invalid chars
(the filename cannot contain special chars or spaces, only
alphanumeric and -).

On Jan 22, 8:23 am, Johann Spies <johann.sp...@gmail.com> wrote:
> 2010/1/20 mdipierro <mdipie...@cs.depaul.edu>:
>
>
>
> > You should not block access to thinks that are in static. Things in
> > static should be considered ublic by default so that you can ask the
> > web server to serve then and by-pass web2py. This is an optimization
> > that you will need in production and cannot give up.
>
> > If some files need restrited access make a folder applications/myapp/
> > private/static and a new controller action
>
> > @auth.requires_login()
> > def static():
> >    # check if if user has permission
> >    # raise HTTP(401,"not authorized") otherwise
> >    filename = '/'.join(request.args)
> >    fullpath = os.path.hoin
> > (request.folder,'private','static',filename)
> >    return response.stream(open(fullpath,'rb'))
>
> > access the file with
>
> >http://.../myapp/defalt/static/filename.xxx
>
> > Hope this helps.
>
> Unfortunately not.  I get an "Invalid request" error.
>
> Regards
> Johann

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to