-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix DateField.to_representation
to work with Python 2 unicode.
#3819
Merged
xordoquy
merged 1 commit into
encode:master
from
m1kola:bug/DateField-to_representation-unicode-compatibility
Jan 11, 2016
Merged
Fix DateField.to_representation
to work with Python 2 unicode.
#3819
xordoquy
merged 1 commit into
encode:master
from
m1kola:bug/DateField-to_representation-unicode-compatibility
Jan 11, 2016
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m1kola
force-pushed
the
bug/DateField-to_representation-unicode-compatibility
branch
3 times, most recently
from
January 10, 2016 22:22
d474afc
to
82d83fc
Compare
m1kola
changed the title
DateField.to_representation can't work with unicode value
PY2: DateField.to_representation can't work with unicode value
Jan 10, 2016
I think this is a pretty valid enhancement. We could probably just test for |
@@ -1139,7 +1139,7 @@ def to_representation(self, value): | |||
) | |||
|
|||
if output_format.lower() == ISO_8601: | |||
if (isinstance(value, str)): | |||
if isinstance(value, (six.string_types, six.text_type)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string_types
is enough, you don't need the test_type
here
m1kola
force-pushed
the
bug/DateField-to_representation-unicode-compatibility
branch
from
January 11, 2016 10:15
82d83fc
to
6b207d9
Compare
PR was updated according comments. |
xordoquy
added a commit
that referenced
this pull request
Jan 11, 2016
…unicode-compatibility PY2: DateField.to_representation can't work with unicode value
Thanks ! |
m1kola
deleted the
bug/DateField-to_representation-unicode-compatibility
branch
January 11, 2016 10:30
xordoquy
changed the title
PY2: DateField.to_representation can't work with unicode value
Fix Feb 11, 2016
DateField.to_representation
to work with Python 2 unicode.
This was referenced Mar 9, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello!
Seems like
DateField.to_representation
doesn't work withunicode
values on Python 2.*, but it can acceptstr
values. I think it should work withunicode
too.Here is example:
Traceback:
I can reproduce this behaviour on 3.3.1 and master.