Skip to content

Mapped Types (example) broken #23

@clauspruefer

Description

@clauspruefer

Code

import mincepy
import uuid

historian = mincepy.connect('mongodb://127.0.0.1/mince-mapped-types', use_globally=True)

class Car:
    def __init__(self, make='ferrari', colour='red'):
        self.make = make
        self.colour = colour

    def __str__(self):
        return "{} {}".format(self.colour, self.make)


class CarHelper(mincepy.helpers.TypeHelper):
    TYPE = Car
    TYPE_ID = uuid.UUID('21605412-30e5-4f48-9f56-f0fa8014e746')
    make = mincepy.field()
    colour = mincepy.field()

historian.register_type(CarHelper)

Exception

File "/home/cpruefer/Documents/mincepy/mincepy-test.py", line 15, in <module>
    class CarHelper(mincepy.helpers.TypeHelper):
    ...<3 lines>...
        colour = mincepy.field()
TypeError: HelperMeta.__new__() missing 2 required keyword-only arguments: 'obj_type' and 'type_id'

Python Version

cpython 3.13.3

Blame Me

Sorry, did not have much time for debugging deeper myself.

Remark

I had the plan to integrate mincepy into my python-micro-esb project, but it does not really match the requirments. The mincepy interface uses direct class assignment / Mapped Types, the python-micro-esb uses hierachical class instancing / relation mapping from JSON metadata.

In my oppinion the mincepy base conecpt / layout is pretty cool (especially the object transformation and versioning feature). If i had more time (and money) i would love to participate.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions