Am 07.07.2010 um 15:48 schrieb Paul Johnston:

Hi,

What is your actual use-case btw? Is it really for converting to unicode, or more to have some declarative repr-functionality? That I'd like to see.

My main use case is populating SingleSelectFields - my fledgling tw2
framework uses roughly [(x.id, unicode(x)) for x in Table.query.all()]
to populate these. Having __unicode__ defined is important. It's much
better to use this rather than __str__ so my applications are unicode
safe end-to-end. This isn't just tw2 craziness; Django takes the same
approach.

So all I want is a shorter way of defining the __unicode__ method.
Your idea of UnicodeEntity is definitely better than my current
approach. I would like to save another line and be able to say
"tounicode=True" but maybe that is a bad idea.

This usecase is IMHO not something an ORM should bother about. Because it would never fulfill all the wishes. One page needs the email, the next the username, one a custom function like "if username then username else email".

Essentially, it's the same with JSON - and I'm more than happy with generic method solutions to that.

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.

Reply via email to