#9814: Python 2.6's sqlite refuses 8-bit SafeStrings ---------------------------------------------------+------------------------ Reporter: kmtracey | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.0 Resolution: | Keywords: Stage: Unreviewed | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---------------------------------------------------+------------------------ Changes (by mtredinnick):
* needs_better_patch: => 0 * needs_tests: => 0 * needs_docs: => 0 Comment: This looks like another case like MySQL, where it's doing a bad type check. `isinstance(SafeString, str)` is `True`, so it should just work with safe strings as strings if it needs strings, like everything else does. It's not illegal to use `SafeString` wherever all good strings are accepted (much like American Express :-) ), so we have to fix this. However, if it's only `SafeString` that's the problem, we don't need any decoding or encoding. It's already required to be a bytestring, since it's a "str" subclass, not a "unicode" subclass. Thus, simple `str()` on the object will be the right thing, I suspect. Don't have time to test this out now. Only wanted to note that I think (a) we should add the adaptor if that's really required, (b) I'm still not loving the Python 2.6 developers because this should be completely unnecessary as we're already giving them something that acts as a str, and (c) we should check `SafeUnicode` for equivalent issues (and if the fact that `SafeUnicode` is a unicode means it gets a free ride, please refer to point (b)). -- Ticket URL: <http://code.djangoproject.com/ticket/9814#comment:1> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---