#29086: Bytestrings on CharFields getting saved as "b'data'"
-------------------------------------+-------------------------------------
     Reporter:  Collin Anderson      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  2.0
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Jon Dufresne):

 > Now, this change should at least have been mentioned in the 2.0 release
 notes.

 The [https://docs.djangoproject.com/en/dev/releases/2.0/#removed-support-
 for-bytestrings-in-some-places release notes say]:

 > To support native Python 2 strings, older Django versions had to accept
 both bytestrings and unicode strings. Now that Python 2 support is
 dropped, bytestrings should only be encountered around input/output
 boundaries (handling of binary fields or HTTP streams, for example). You
 might have to update your code to limit bytestring usage to a minimum, as
 Django no longer accepts bytestrings in certain code paths.
 >
 > For example, `reverse()` now uses `str()` instead of `force_text()` to
 coerce the `args` and `kwargs` it receives, prior to their placement in
 the URL. For bytestrings, this creates a string with an undesired `b`
 prefix as well as additional quotes (`str(b'foo')` is `"b'foo'"`). To
 adapt, call `decode()` on the bytestring before passing it to `reverse()`.

 Does that cover what you're looking for?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29086#comment:5>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.eaaf9c2622b3fecf41f95060096eefe8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to