I haven't tested it, but you could do something like
import base64
def my_awesome_api():
def b64representer(path, row):
fname, stream = db.table_name.your_upload_field.retrieve(path)
return {'filename': fname, 'data': base64.b64encode(stream.read())}
db.table_name.your_upload_field.represent = b64representer
return response.json(list(db(db.table_name.id > 0).select().render()))
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.