The view is not clear to me. Where is the for loop closed?

Changing db.mytable.myfile.uploadfolder in a loop does not look like a
good idea since it is used only by form.accepts.


On Jan 10, 6:16 pm, weheh <richard_gor...@verizon.net> wrote:
> I'm building an app where user-uploaded jpeg files go into uploads/
> auth.user.id/mytable.myfile.crypto.suffix. Here's some pseudo code...
>
> # model
> db.define_table('mytable',Field('auth_user',db.auth_user),Field
> ('myfile',upload'))
>
> Then, depending on the user logged in,
>
> db.mytable.myfile.uploadfolder=os.path.join
> (request.folder,'uploads',auth.user.id)
>
> Problem is when it comes time to download. I'm doing something like
> this:
>
> # view
> {{
> for x in db().select(db.mytable.myfile):
>   db.mytable.myfile.uploadfolder=os.path.join
> (request.folder,'uploads',x.auth_user)
>   url=URL(r=request,c='default',f='download',args=x.myfile)}}
>
> {{=IMG(_src=url)}}
>
> Problem is, the only images that get downloaded are for the currently
> signed in user. The images from other users aren't getting downloaded.
>
> Any thoughts about how to do this correctly?
-- 
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