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

porting to mongoengine #63

Open
jacobeverist opened this issue Jun 16, 2017 · 0 comments
Open

porting to mongoengine #63

jacobeverist opened this issue Jun 16, 2017 · 0 comments

Comments

@jacobeverist
Copy link

jacobeverist commented Jun 16, 2017

I'm trying to port this package to mongoengine and marshmallow-mongoengine

https://github.com/jacobeverist/flask-marshmallow

I've commented out the sqla stuff for the time being until I can verify that the mongo tests work.

I can get the first test to pass, but I am having trouble with hyperlinkrelated tests to pass. I have done my best to replace sql backrefs with ReferenceFields. I've had to add an ObjectId converter for the serialization and stop passing the db session around since that's an sqla thing.

I can serialize just fine, but i'm having trouble with the deserialization part. Can I get an expert pair of eyes on this? Please start up a default MongoDB server on the default port using docker run -d -p 27017:27017 mongo or something similar when running the tests.

Run invoke test

    def _deserialize(self, value, *args, **kwargs):
        if self.external:
            parsed = parse.urlparse(value)
            value = parsed.path
        endpoint, kwargs = self.adapter.match(value)
        if endpoint != self.endpoint:
            raise ValidationError(
                (
                    'Parsed endpoint "{endpoint}" from URL "{value}"; expected '
                    '"{self.endpoint}"'
                ).format(**locals())
            )
        if self.url_key not in kwargs:
            raise ValidationError(
                'URL pattern "{self.url_key}" not found in {kwargs!r}'.format(**locals())
            )
        print("input:", self.url_key, args, kwargs)
>       return super(HyperlinkRelated, self)._deserialize(kwargs[self.url_key], *args, **kwargs)
E       TypeError: _deserialize() got an unexpected keyword argument 'id'

flask_marshmallow/mongoengine.py:95: TypeError
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

No branches or pull requests

1 participant