Looks promising ... but how should I register this converter and is it possible to have more than one converter registered for schema.Object? In case I have two or more places in which I have nested objects like this. I have the impression that ming lacks the properties parameter in the mapper function and also lacks a relationship function just like SQLAlchemy does on this scenario.
Em ter, 22 de dez de 2020 11:12, Vincenzo Castiglia < [email protected]> escreveu: > ok, then what about subclassing like this > ``` > class MyConverter(schema.Object): > def _validate(self, d, allow_extra=False, strip_extra=False): > return MyClass(super()._validate(d, allow_extra=allow_extra, > strip_extra=strip_extra)) > ``` > assuming your class have a __init__ that takes a dict or is a subclass of > collections.UserDict > > Il giorno mar 22 dic 2020 alle ore 14:54 Rafael Ribeiro < > [email protected]> ha scritto: > >> Not exactly since it'll convert back to a ming.base.Object as per the >> documentation. I was looking for something that would be able to convert >> back to an arbitrary class from my code. >> >> Em ter., 22 de dez. de 2020 às 08:27, Vincenzo Castiglia < >> [email protected]> escreveu: >> >>> are you looking for schema.Object? >>> https://ming.readthedocs.io/en/latest/api/ming.schema.html#ming.schema.Object >>> >>> >>> Il giorno lun 21 dic 2020 alle ore 15:33 Rafael Ribeiro < >>> [email protected]> ha scritto: >>> >>>> Hi all, >>>> >>>> I am porting an application from mongoengine to ming and I wished to >>>> map a nested document. I've seen another post mentioning the subdocument >>>> feature but since I am not using the declarative approach to mapping I'd >>>> like to know whether it is possible to do it using the imperative mapping >>>> approach ( >>>> https://ming.readthedocs.io/en/latest/baselevel.html#ming-baselevel ). >>>> Is it possible to load an object and have another class nested inside? >>>> >>>> best regards, >>>> Rafael >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "TurboGears" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/turbogears/9e80790c-5260-4485-a8cc-ddbbddfdfd4dn%40googlegroups.com >>>> <https://groups.google.com/d/msgid/turbogears/9e80790c-5260-4485-a8cc-ddbbddfdfd4dn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "TurboGears" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/turbogears/i2K3aaIe8GQ/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/turbogears/CABFU5vsmWAdzrR_ASBd3kafL-Ru4WiqViaVbbywCOb3o8y7JKg%40mail.gmail.com >>> <https://groups.google.com/d/msgid/turbogears/CABFU5vsmWAdzrR_ASBd3kafL-Ru4WiqViaVbbywCOb3o8y7JKg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "TurboGears" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/turbogears/CA%2BfCSi0WH%3DOE%3DbfE%3DzMQUQaSE65b2ABeQUrHD7F9HzHAzqFusw%40mail.gmail.com >> <https://groups.google.com/d/msgid/turbogears/CA%2BfCSi0WH%3DOE%3DbfE%3DzMQUQaSE65b2ABeQUrHD7F9HzHAzqFusw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "TurboGears" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/turbogears/i2K3aaIe8GQ/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/turbogears/CABFU5vvu008YbFDJUaKmtStze7zoQNn8%2BWQuAZ_KHFb-RT%2Bzvg%40mail.gmail.com > <https://groups.google.com/d/msgid/turbogears/CABFU5vvu008YbFDJUaKmtStze7zoQNn8%2BWQuAZ_KHFb-RT%2Bzvg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/turbogears/CA%2BfCSi1-gRtEkZRa_gp1zQiA9HvjUXzuYewYmh09AsAmn7qUQw%40mail.gmail.com.

