This commit is contained in:
Andrew Miller 2017-07-25 16:56:26 +01:00
parent 3173384d68
commit dadfdaee12

View file

@ -34,6 +34,7 @@ else:
# Code from six egg https://bitbucket.org/gutworth/six/src/a3641cb211cc360848f1e2dd92e9ae6cd1de55dd/six.py?at=default
def add_metaclass(metaclass):
"""Class decorator for creating a class with a metaclass."""
def wrapper(cls):
@ -48,8 +49,13 @@ def add_metaclass(metaclass):
@python_2_unicode_compatible
class MSFList(list):
def __init__(self, choices, *args, **kwargs):
self.choices = choices
super(MSFList, self).__init__(*args, **kwargs)
def __str__(msgl):
l = [choices.get(int(i)) if i.isdigit() else choices.get(i) for i in msgl]
l = [msgl.choices.get(int(i)) if i.isdigit() else msgl.choices.get(i) for i in msgl]
return u', '.join([string_type(s) for s in l])