Christoph Zwerschke schrieb:
> At least with SQLAlchemy you can do this very conveniently on the model 
> level, e.g. by defining a case insensitive datatype (see 
> http://www.sqlalchemy.org/docs/types.myt). You can change this in the 
> user table in your model.py file.

Thanks for the tip! I have now created a custom type like this:

class CIUnicode(Unicode):
    """Case-insensitive unicode string type."""

    def convert_bind_param(self, value, engine):
        return value.lower()
    def convert_result_value(self, value, engine):
        return value.lower()

and changed my User class accordingly:

users_tbl = Table('tg_user', metadata,
    ...
    Column('user_name', CIUnicode(255), unique=True),
    Column('email_address', Unicode(255), unique=True),
    ...
    Column('password', CIUnicode(40)),
    ...

which works perfectly.

Cheers again, Chris

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to