Am 06.07.2010 um 16:17 schrieb Paul Johnston:
Hi,
Erm, why don't you use a Unicode-column in the first place?
Well, I probably should, but the point of what I'm asking is
automatically define the method to convert a class instance to a
unicode object.
You mean you want a declaration for one field that says "this field is
the __unicode__"-representation? I don't think that would make much
sense. What is the behavior for several such columns having that
attribute? How is coercion/decoding handled, which btw your example
lacks?
I'd go for a custom base-class + a class-attribute, like this
class UnicodeEntity(Entity):
UNICODE_COL = None
def __unicode__(self):
return getattr(self, self.UNICODE_COL)
Diez
--
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en.