How do you create a dynamic uploadfolder for an upload Field?

I tried using:
uploadfolder= lambda r: db.repository(r.repository_id).directory

but i get the error message, I guess it doesn't have the same functionality 
as compute: 
cannot concatenate 'str' and 'function' objects

I'm also using custom_store/retreive to maintain the files original filename

def store_file(file, filename=None, path=None):
    path = path # "applications/init/uploads"
    if not os.path.exists(path):
         os.makedirs(path)
    pathfilename = os.path.join(path, filename)
    dest_file = open(pathfilename, 'wb')
    try:
            shutil.copyfileobj(file, dest_file)
    finally:
            dest_file.close()
    return filename


If I can set the uploadfolder dynamically then it's passed to store_file as 
path.

I also tried:
path = db.repository(db.workbench(db.workbench.name==filename).repository).
directory

But it can't find a record, I guess because store_file is run before the 
record is created in the db.

Any suggestions?

Thank you!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to