On Wednesday, September 27, 2017 at 5:04:27 AM UTC-4, Rudy wrote:
>
> Dave / Anthony,
>
> Thanks for your input and confirmation. I will look into the code to see 
> how i can use the uuid to separate files for multi-tenant purpose.
>

If you're going to be accessing the uploaded files based on the filenames 
stored in the database, you don't necessarily need to do anything with the 
filesystem to enable multi-tenant functionality. The database records will 
identify the tenants and therefore enable you to identify which files 
belong to which tenants.

However, if you need to easily be able to identify files associated with a 
given tenant from the filesystem only (i.e., without reference to the 
database records), then you could create separate top-level upload folders 
for each client. In your code, you would do that by dynamically specifying 
the "uploadfolder" argument of the Field() constructor to set a unique 
folder for each client. For example:

uploadfolder=os.path.join(request.folder, 'uploads', tenant_id)

You could still leave uploadseparate=True, and then you'll get folders like:

/uploads/1/company.logo/ab/
/uploads/2/company.logo/dy/

where 1 and 2 are the id's of different tenants.

Anthony

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to