Consider the following example,
@request.restful()
def api():
def PUT(table, **fields):
if not table == 'person': raise HTTP(400)
fields.picture = db.person.picture.store(fields.picture.file,
filename=fields.picture.filename) #ERROR:dict() object has no attribute
picture
return db.person.validate_and_insert(**fields)
return locals()
As a workaround I can either, assign it in dict way:
@request.restful()
def api():
def PUT(table, **fields):
if not table == 'person': raise HTTP(400)
fields['picture'] = db.person.picture.store(fields['picture'].file,
filename=fields['picture'].filename)
return db.person.validate_and_insert(**fields)
return locals()
or change it to Storage class:
from gluon.storage import Storage
@request.restful()
def api():
def PUT(table, **fields):
if not table == 'person': raise HTTP(400)
fields = Storage(fields)
fields.picture = db.person.picture.store(fields.picture.file,
filename=fields.picture.filename)
return db.person.validate_and_insert(**fields)
return locals()