Compute Field and Upload Field

20 views
Skip to first unread message

Federico Ferraro

unread,
Jul 25, 2019, 12:14:36 PM7/25/19
to web2py-...@googlegroups.com
HI
I have a problem with restful service
@request.restful()
def api():
response.view = 'generic.json'
def GET(tablename, id):
if not tablename == 'caras':
raise HTTP(400)
return dict(person = db.caras(id))

def POST(tablename, **fields):
if not tablename == 'caras':
raise HTTP(400)
return db.caras.validate_and_insert(**fields)
return locals()
I send POST with a image and insert in database
But I use a compute field in my model
db.define_table('caras',
Field('persona','reference personas'),
Field('foto','upload'),
Field('vector',compute=calcencoding)
)
def calcencoding(r):
print r
when upload via form
<OpRow {'foto': 'caras.foto.9d9a651c00497241.666f746f2028313429.txt', 'persona': 1}>
when upload with post :
<OpRow {'foto': FieldStorage('foto', 'foto', '\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00C\x00\x02\x01\x01\x01\x01\x01\x02\x01\x01\x01\x02\x02\x02\x02\x02\x04\x03\x02\x02\x02\x02\x05\x04\x04\x03\x04\x06\x05\x06\x06\x06\x05\x06\x06\x06\x07\t\x08\x06\x07\t\x07\x06\x06\x08\x0b\x08\t\n\n\n\n\n\x06\x08\x0b\x0c\x0b\n\x0c\t\n\n\n\xff\xdb\x00C\x01\x02\x02\x02\x02\x02\x02\x05\x03\x03\x05\n\x07\x06\x07\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\xff\xc0\x00\x11\x08\x00i\x00V\x03\x01"\x00\x02\x11\x01\x03\x11\x01\xff\xc4\x00\x1f\x00\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\xff\xc4\x00\xb5\x10\x00\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04\x00\x00\x01}\x01\x02\x03\x00\x04\x11\x05\x12!1A\x06\x13Qa\x07"q\x142\x81\x91\xa1\x08#B\xb1\xc1\x15R\xd1\xf0$3br\x82\t\n\x16\x17\x18\x19\x1a%&\'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz\x83\x84\x85\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xff\xc4\x00\x1f\x01\x00\x03\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\xff\xc4\x00\xb5\x11\x00\x02\x01\x02\x04\x04\x03\x04\x07\x05\x04\x04\x00\x01\x02w\x00\x01\x02\x03\x11\x04\x05!1\x06\x12AQ\x07aq\x13"2\x81\x08\x14B\x91\xa1\xb1\xc1\t#3R\xf0\x15br\xd1\n\x16$4\xe1%\xf1\x17\x18\x19\x1a&\'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xff\xda\x00\x0c\x03\x01\x00\x02\x11\x03\x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\x1f\xbdU\x19\x1d3EZ1m\xa6{G\x81\xbca>\x8d\xa1;\\\x88"He\xf3X\xa2e\xa4\x07\x8cg\xdb\xfa\xd7[\xa6j>\x18\xf1\xcd\xa9\xd44\xdb\xc6IG\xfa\xc3m!\x07\xf1\xc7\xd6\xbc\x96\xe3\xfeE\xa9\xbf\xdd\xab?\xb3\x87\xfc\x8d7?O\xe8k\x92\xbe\xa9\x91JO\x9a\xc7\xabE\xa7=\xa3\x96\x7f\x12_\xb1\x03\x80s\xd0V\x86\x9f\xaf\xc5n\x06\xc9\xa5\x94\x01\x86yy\xfeu=\xe7A\xfe\xf5b\xdd\x7f\xac\x7f\xa7\xf4\xaf\x16\xa3\xbb=8-Y\xd7\xe9\xde<\xb4\xb5M\xb71\x95\x1c\x9c\xaa\xd5\xe6\xf8\xbb\xe1Kh\xdc\xfd\xab\x1bFp\xc3\xady\xa6\xa3\xfe\xbb\xfe\x05\xfd+\x84\xf1\x17\xfa\xe7\xff\x00\xaeF\xb3Q\xbb4\xb1\xe9?\x10?h\xbf\rEo$v\xd3\x86*1\x95\xef\xf8\xd7\xce\x9f\x13~$\x0f\x10\xdcK\x15\xb3\x82\x84\xf5\xdd\xdb\xda\xab\
xf8\x83\xee?\xfb\xc6\xb9K\xef\xba\xdf\xef\xff\x00J\xf4\xf0\xf4\x96\xe6\x12fD\xcb\xbaS\xb4\x02Kw\x15\xa7\xa5\x90\xbc\x90\x068\xe2\xb3O_\xf8\x10\xab\x9ao\xde_\xf7\x7f\xadzQ\xd9\x1c\xf2H\xe9,\xe3I#\xdd!\xc7\xb0\xfetUk?\xf8\xf6\x1f\x87\xf5\xa2\xa9_\xb9\x8d\xcf\xff\xd9')}>
whats diference ??
--
Federico Ferraro
Usuario Linux : 482533.
--
Reply all
Reply to author
Forward
0 new messages