Just realized a possible issue. It's simple enough to rename the strings 
that will become the database contents form 'no_table.[whatever]' to 
'table_name.[whatever]' (i.e. doing a replace() on the appropriate 
form.vars), but if your upload field definitions have uploadseparate = 
True, will this thwart the appropriate renaming of files through 
os.rename()* by making the file locations unpredictable when you have a 
large enough number of files? To remedy this, is it possible to specify 
what the name of the file should be before it is stored?

* as recommended by Anthony in this 
thread<https://groups.google.com/forum/#!searchin/web2py/change$20name$20of$20file/web2py/yaVPY02Z2ZU/AbOyfW0k-ZQJ>


On Monday, April 1, 2013 9:45:03 AM UTC-5, Niphlod wrote:
>
> there's no feature to leverage in the current code.....
> After all, a "factory" is something "ethereal" where your code needs to 
> manage db interactions (and whatever needs to be done).
>
> SQLFORM.factory is just a shortcut:
> - to "play" with your current models
> - to save you defining a table just to generate a form ('cause you can 
> pass Field() to it)
> - have default validators available
>
> you can't expect more "auto-magic" features out of it.... You can use 
> _filter_fields() to see which table belongs the input name, as long as your 
> input names are distinct.
>
> On Monday, April 1, 2013 4:31:47 PM UTC+2, Lamps902 wrote:
>>
>> If you have something like the following:
>>
>> form = SQLFORM.factory(db.table1, db.table2)
>>
>> and table1 has an 'upload' field named 'file1', with table2 containing an 
>> 'upload' field named 'file2', the filenames stored in the tables will end 
>> up as 'no_table.file[number].[unique_file_identifier].[extension]. The 
>> 'no_table' part can be changed by passing the 'tablename' argument to 
>> factory(), but this will not help when there are multiple uploads from 
>> different tables. Is there a straightforward way (i.e. by passing arguments 
>> to factory()) to make the upload file names correspond to their respective 
>> tables, or would that have to be handled manually? Thanks.
>
>

-- 

--- 
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/groups/opt_out.


Reply via email to