Imagine this scenario:
TEMP_IMAGES = path.join(request.folder, 'uploads/temp')
TEST_IMAGES = path.join(request.folder, 'uploads/test')
db.define_table('temp_images',
Field('add_date', 'datetime', default=request.now),
Field('original', 'upload', autodelete=True,
uploadfolder=TEMP_IMAGES),
Field('image', 'upload', autodelete=True,
uploadfolder=TEMP_IMAGES)
db.temp_images.image.requires = lambda row: make_thumb(row.original) #THIS IS BRUNO ROCHA`s MAKE THUMB FUNCTION IN WEB2PY RECIPES/SLICES
db.define_table('test_images',
Field('image', 'upload', autodelete=True,
uploadfolder=TEST_IMAGES))
if I perform this:
row = db.temp_images(1)
(filename, stream) = db.temp_images.original.retrieve(row.original)
db.test_images.insert(image=db.test_images.image.store(stream, filename))
it stores the image in the other table / folder,
however if I perform this:
row = db.temp_images(1)
(filename, stream) = db.temp_images.image.retrieve(row.image)
db.test_images.insert(image=db.test_images.image.store(stream, filename))
I receive this error:
IOError: [Errno 2] No such file or directory: '/web2py/applications/test/uploads/temp/temp_images.image.8f7f4653c49cff58.74656d705f696d616765732e6f726967696e616c2e393736396565356638393539376332622e333833363334333635663634363537343631363936633566363236623637363432653661373036375f696d672e6a7067.jpg'Note the size of the filename is not compatible with the size in folder, even the name does not have _thumb.jpg as in folder
temp_images.original.9769ee5f89597c2b.383634365f64657461696c5f626b67642e6a7067.jpg (this is in folder)
well, I was using this with tables with only one upload field with no problem, now that I have 2 or 3 fields, the function retrieve only work with the FIRST defined field.
maybe I am doing it wrong, but maybe there is a bug on retrieve function
Best regards!!