Author lambacck
Recipients barry, eli.bendersky, ethan.furman, lambacck
Date 2013-08-03.12:57:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1375534652.92.0.146277796903.issue18635@psf.upfronthosting.co.za>
In-reply-to
Content
My use case is a generic mixin for Enums and a generic mixin for Django ORM fields that uses the Enums to generate choices. 

The Enum mixin has to call cls.__class__._get_mixins_(cls.__bases__) to get the member_type so that it can call the member_type.__new__ method (currently using this for int and str). I'm currently setting _member_type_ on the class if it doesn't already exist in the Enum class.

The Django ORM field mixin has a to_python method where it is supposed to take input from the db/web and turn it into the python type (in this case an Enum). If we get a str from the web and we are going to an int, we need to run int on it. The generic way to do this in the mixin is to pass the value to _member_type_ as a function.

I think I have all the bugs out of my implementation so I should be able to extract it out of my app and make it open source this week.
History
Date User Action Args
2013-08-03 12:57:32lambaccksetrecipients: + lambacck, barry, eli.bendersky, ethan.furman
2013-08-03 12:57:32lambaccksetmessageid: <1375534652.92.0.146277796903.issue18635@psf.upfronthosting.co.za>
2013-08-03 12:57:32lambaccklinkissue18635 messages
2013-08-03 12:57:32lambacckcreate