This change defines __str__ and __unicode__ on the Choice type such that it returns the stringified result of the underlying value.
Previously, it was difficult to use a Choice type in a stache expression, since the result would always be stringified as a Choice struct, even if the underlying value were a basic type.
For example, given the following Choice type:
C = Choice([Integer, String])
One might want to use the value in a stache template, since both Integer and String are basic types. Previously, this would result in a stache substitution like Choice_Integer_String('hello'). With this change, it will result in a stache substitution of just the underlying value hello.
This change defines
__str__
and__unicode__
on the Choice type such that it returns the stringified result of the underlying value.Previously, it was difficult to use a Choice type in a stache expression, since the result would always be stringified as a Choice struct, even if the underlying value were a basic type.
For example, given the following Choice type:
C = Choice([Integer, String])
One might want to use the value in a stache template, since both Integer and String are basic types. Previously, this would result in a stache substitution like
Choice_Integer_String('hello')
. With this change, it will result in a stache substitution of just the underlying valuehello
.