So in testing that I’m doing the right thing per your advice, I stumbled on an interesting situation: I can use row['media'].url
to return the URL string in the client side code but not in a server module.
In a test app, I query a row in my data table that contains a Media object (row
). I have one button that calls a server function for row
, and the code attempts to print the URL once on the server side and once on the client side.
Client code (in Form1):
def button_1_click (self, **event_args):
row = anvil.server.call('get_row')
print(row['media'].url) # prints URL
Server code:
@anvil.server.callable
def get_row():
row = tables.app_tables.my_table.get(key='PDF Row')
print(row['media'].url) # prints None
return row
The output then prints:
None
(The huge URL for the file)
I also tested the server side with Python 3.6, 2.7, and restricted 2, and all resulted in printing None
. Is this to be expected? It seems like a bit of an odd inconsistency.