Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle colander.null for mapped schemas in objectify #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tsauerwein
Copy link

I am having a schema like the following:

    class DocumentGeometry(Base):
        __tablename__ = 'document_geometries'
        id = Column(Integer, primary_key=True)
        document_id = Column(
            Integer, ForeignKey('documents.document_id'),
            nullable=False)
        geom = Column(String)

    class Document(Base):
        __tablename__ = 'documents'

        document_id = Column(Integer, primary_key=True)
        geometry = relationship(DocumentGeometry, uselist=False)

    schema = SQLAlchemySchemaNode(Document)

When I try to use schema.objectify({geometry: colander.null, document_id: null}), I was seeing the following error message:

    value = self[attr].objectify(dict_[attr])
  File ".../ColanderAlchemy/colanderalchemy/schema.py", line 687, in objectify
    for attr in dict_:
TypeError: '_null' object is not iterable

When the value for attribute geometry is colander.null, None should simply be used as value instead of trying to call objectify with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant