Hi. i hope this will help.
this is my try to use sqlobject(sqlobject-0.8dev_r1814-py2.4.egg)with mssql.

because mssql has nvarchar(which is unicode version of varchar),  i  change this in
sqlobject\col.py :


class SOUnicodeCol(SOStringLikeCol):
    def __init__(self, **kw):
        self.dbEncoding = popKey(kw, 'dbEncoding', 'utf-8')
        super(SOUnicodeCol, self).__init__(**kw)

    def createValidators(self):
        return [UnicodeStringValidator(db_encoding=self.dbEncoding)] + \
            super(SOUnicodeCol, self).createValidators()

    def _mssqlType(self):
        return 'NVARCHAR(%i)' % self.length

class UnicodeStringValidator(validators.Validator):
    def to_python(self, value, state):
        if value is None:
            return None
        if isinstance(value, unicode):
            return value
        if isinstance(value, array_type): # MySQL
            return unicode(value.tostring(), self.db_encoding)
        return unicode(value, self.db_encoding)

    from_python = to_python



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to