Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions notion/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ def call_load_page_chunk(self, page_id):

def store_recordmap(self, recordmap):
for table, records in recordmap.items():
if records is None: continue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be a field (__json__) in the user content that is occasionally set to None. This simply does a quick check and skips adding any empty record sets to the store.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work. But still, I'm uneasy as to why this is occurring right now or this is the prelude to major API changes.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha! This broke everything all at once for us 💯

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to the change in this pull request or the bug?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to the change in this pull request or the bug?

The bug! Thank you for the fix :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing... It was a quick change, just making sure it didn't have some other consequences 😄

Copy link

@ttran ttran Feb 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For folks wanting to monkey patch their code while waiting on the merge:

import notion
def store_recordmap(self, recordmap):
    for table, records in recordmap.items():
        if records is None: continue
        for id, record in records.items():
            self._update_record(
                table, id, value=record.get("value"), role=record.get("role")
            )
notion.store.RecordStore.store_recordmap = store_recordmap

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to modify the first line in the above snippet to be import notion.store instead of import notion for it to work for me with python3.6 and notion==0.0.27.

thank you for the workaround until this gets merged!

for id, record in records.items():
self._update_record(
table, id, value=record.get("value"), role=record.get("role")
Expand Down