I have an app where a user can create a project, this has 10 “global pushes” - rows in a data table that are placeholders for some sorting later on.
When the user updates an Interview, they add Push items to a push data table. I want to automatically assign new Push objects to the first global push - “Ungrouped Pushes”.
For some reason, I’m getting:
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
Now I know this means I’m passing None as the first argument, but this is what I don’t understand:
This code works as planned:
#add a push from the interview page
@anvil.server.callable
def new_push(interview, new_push):
app_tables.pushes.add_row(Interview=interview, Push= "When I " + new_push)
this_push = app_tables.pushes.get(Push="When I " + new_push, Interview=interview)
p_id = this_push.get_id()
anvil.server.call('new_push_to_global_push', interview, p_id)
Which triggers this code:
#link a new push to the global pushes bucket
@anvil.server.callable
def new_push_to_global_push(interview, p_id):
#automatically link this new push to the placeholder bucket row and project
#bag the push
this_push = app_tables.pushes.get_by_id(p_id)
print(this_push)
#bag the project
this_project = interview['Project']
#bad the Ungrouped Pushes bucket
start_global_push = app_tables.global_push.get(Project=this_project, global_push_name= 'Ungrouped Pushes')
print(start_global_push)
#add this push to the ungrouped pushes bucket
start_global_push["linked_pushes"] += [this_push]
And the final output shows that the print lines are pushing out:
<LiveObject: anvil.tables.Row>
<LiveObject: anvil.tables.Row>
If I run .search on the data table for Grouped Pushes, I can find the right row with the same parameters passed above.
So why is it returning a row from the get method, then nothing when I try to update the row with the push?
Here’s the data table:
(ignore the first two rows, they were testing the pre-build before I needed this functionality)
The other two data tables are performing as expected, but I can add them if you think it will help. I have similar code working on other parts of the site - it’s probably some stupid error, but I can’t seem to see it. Can you help?