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

Mapper inheritance #178

Open
dimonji opened this issue Apr 4, 2019 · 0 comments
Open

Mapper inheritance #178

dimonji opened this issue Apr 4, 2019 · 0 comments

Comments

@dimonji
Copy link

dimonji commented Apr 4, 2019

Hi, I have some problems

# -*- coding: utf-8 -*-
from kim import field, Mapper


class A(Mapper):
    __type__ = dict

    a = field.Integer()


class B(Mapper):
    __type__ = dict

    b = field.Integer()


class C(A, B):
    __type__ = dict

    c = field.Integer()


sample = {'a': 1, 'b': 2, 'c': 3}
print('serialized', C(obj=sample).serialize())
print('marshalled', C(data=sample).marshal())

Output is:

python3.7 mapper_test.py
{'a': 1, 'c': 3}
{'a': 1, 'c': 3}

Process finished with exit code 0

Is can Kim have right way to create mapper from inheritance?

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