On Monday, August 5, 2019 at 11:28:43 PM UTC-7, Константин Комков wrote: > > *Val K*, it is my table.py file: > db.define_table( > 'recipes', > Field('NAME',length=512), > Field('IMAGE','upload'), > migrate=False > ) > It's code in my default.py file: > row = db().select(db.recipes.IMAGE).first() > > image = str(dir(row)) > >>> >
row.keys() is more interesting than dir(row) > image = str(dir(row.IMAGE)) > >>> > ['_BlobReader__blob_get', '_BlobReader__blobid', > '_BlobReader__bytes_read', '_BlobReader__charset', '_BlobReader__closed', > '_BlobReader__db_handle', '_BlobReader__ensure_open', '_BlobReader__index', > '_BlobReader__is_text', '_BlobReader__mode', '_BlobReader__open', > '_BlobReader__opened', '_BlobReader__pos', '_BlobReader__python_charset', > '_BlobReader__reset_buffer', '_BlobReader__tr_handle', '__class__', > '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', > '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', > '__init__', '__init_subclass__', '__iter__', '__le__', '__lt__', > '__module__', '__ne__', '__new__', '__next__', '__reduce__', > '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', > '__subclasshook__', '__weakref__', '_blob_handle', '_isc_status', > 'blob_charset', 'blob_id', 'charset', 'close', 'closed', 'flush', > 'get_info', 'is_text', 'mode', 'next', 'read', 'readline', 'readlines', > 'seek', 'tell'] > > I can not do row.file.row.IMAGE > > row.file probably doesn't exist, because it would have to be row.keys() (it's not in the attributes, as you've shown), and then looking in a putative row.files for row key or attribute doesn't seem sensible. I don't have any experience with BLOBs, but I believe default/user/download is able to handle them. For a file-based upload field, the upload field is a string that default/user/download uses to locate the file. That is, it is the obfuscated file name, and the rest of the path is defined by the uploadfolder value (default, myapp/uploads), as well as uploadseparate and uploadfs. For BLOBs, you've instead set uploadfield to true. In my case, the file-base one, the attributes are those of a string, but I don't have to do much with it except return it in hrefs. default/users/download will use the path name or the blob field to figure out what to stream. There are times when it is desirable to set up the streaming in your code, and I thought this was one of those times, but Ramos and Val K have pointed out how to use the out-of-the-box tool to do this. /dps -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/c14f5f36-3b83-44ca-9681-ad571bbabde7%40googlegroups.com.