What I’m trying to do:
Set up row ID URLs for image files in a data table so they can be transmitted over HTTP, worked fine until this morning, now I get exceptions telling me I cannot transmit LazyMedia objects over HTTP. Do I have to add a transform onto the object before it gets sent?
What I’ve tried and what’s not working:
Tried getBytes() method on LazyMedia object but getting errors on serializing into the response body. Not sure that this is the right path to go down anyway.
Code Sample:
def get_image(row_id, **p):
row = app_tables.business_media.get_by_id(row_id)
print(row_id)
print(row)
print(row['file'])
if row is not None:
# Returning a Media object serves it as the HTTP response
print('row considered to exist')
return row['file']
else:
print('row considered not to exist')
return anvil.server.HttpResponse(status='404')
So without having to go back through and re-code how I upload images and generate new URLs for all my current assets or whatever the new right way is I am at a loss, cannot currently serve media to the front end of my app. Does stopping LazyMedia from being servable over HTTP achieve some benefit for us?
Help here would be much appreciated.
Thanks,
James