Skip to content

Writing to multi-select with new options breaks state of collection #287

Closed
@austintwu

Description

@austintwu

I'll preface this with "I don't think this is officially supported by the API" as I think it falls under "Utilities to support updating/creating collection schemas" which is currently a TODO.

When writing to a multiple select with options that aren't currently in the Collection's schema, the option isn't written, however, a new property with a "?" icon shows up in Notion.

image

Later on, any attempts to set any attribute in the collection results in this KeyError:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notion/collection.py", line 425, in __setattr__ elif attname in self._get_property_slugs(): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notion/collection.py", line 435, in _get_property_slugs slugs = [prop["slug"] for prop in self.schema] File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notion/collection.py", line 414, in schema for prop in self.collection.get_schema_properties() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/notion/collection.py", line 169, in get_schema_properties prop = {"id": id, "slug": slugify(item["name"])} KeyError: 'name'

There's an easy fix and workaround for my usecase, since I have relatively few/set # of options in the multi select:

  • Workaround: add the options for the multi select beforehand
  • Fix: Change the "?" type property to a Notion supported one, then delete it. (When it's just the "?" one, it can't be deleted for some reason)
    image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions