Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
c7c098cf
Kaydet (Commit)
c7c098cf
authored
Kas 06, 2014
tarafından
Markus Holtermann
Kaydeden (comit)
Baptiste Mispelon
Kas 06, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23770 -- Changed serialization strategy for floats with respect to NaN and Inf
Thanks to w0rp for the report
üst
b07aa52e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
writer.py
django/db/migrations/writer.py
+8
-3
1.7.2.txt
docs/releases/1.7.2.txt
+3
-0
test_writer.py
tests/migrations/test_writer.py
+5
-0
No files found.
django/db/migrations/writer.py
Dosyayı görüntüle @
c7c098cf
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
collections
import
datetime
import
datetime
import
inspect
import
decimal
import
decimal
import
collections
from
importlib
import
import_module
from
importlib
import
import_module
import
inspect
import
math
import
os
import
os
import
re
import
re
import
sys
import
sys
...
@@ -304,7 +305,11 @@ class MigrationWriter(object):
...
@@ -304,7 +305,11 @@ class MigrationWriter(object):
elif
isinstance
(
value
,
SettingsReference
):
elif
isinstance
(
value
,
SettingsReference
):
return
"settings.
%
s"
%
value
.
setting_name
,
{
"from django.conf import settings"
}
return
"settings.
%
s"
%
value
.
setting_name
,
{
"from django.conf import settings"
}
# Simple types
# Simple types
elif
isinstance
(
value
,
six
.
integer_types
+
(
float
,
bool
,
type
(
None
))):
elif
isinstance
(
value
,
float
):
if
math
.
isnan
(
value
)
or
math
.
isinf
(
value
):
return
'float("{}")'
.
format
(
value
),
set
()
return
repr
(
value
),
set
()
elif
isinstance
(
value
,
six
.
integer_types
+
(
bool
,
type
(
None
))):
return
repr
(
value
),
set
()
return
repr
(
value
),
set
()
elif
isinstance
(
value
,
six
.
binary_type
):
elif
isinstance
(
value
,
six
.
binary_type
):
value_repr
=
repr
(
value
)
value_repr
=
repr
(
value
)
...
...
docs/releases/1.7.2.txt
Dosyayı görüntüle @
c7c098cf
...
@@ -49,3 +49,6 @@ Bugfixes
...
@@ -49,3 +49,6 @@ Bugfixes
* Allowed usage of ``DateTimeField()`` as ``Transform.output_field``
* Allowed usage of ``DateTimeField()`` as ``Transform.output_field``
(:ticket:`23420`).
(:ticket:`23420`).
* Fixed a migration serializing bug involving ``float("nan")`` and
``float("inf")`` (:ticket:23770:).
tests/migrations/test_writer.py
Dosyayı görüntüle @
c7c098cf
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
import
datetime
import
datetime
import
math
import
os
import
os
import
re
import
re
import
tokenize
import
tokenize
...
@@ -69,6 +70,10 @@ class WriterTests(TestCase):
...
@@ -69,6 +70,10 @@ class WriterTests(TestCase):
"""
"""
# Basic values
# Basic values
self
.
assertSerializedEqual
(
1
)
self
.
assertSerializedEqual
(
1
)
self
.
assertSerializedEqual
(
1.2
)
self
.
assertTrue
(
math
.
isinf
(
self
.
serialize_round_trip
(
float
(
"inf"
))))
self
.
assertTrue
(
math
.
isinf
(
self
.
serialize_round_trip
(
float
(
"-inf"
))))
self
.
assertTrue
(
math
.
isnan
(
self
.
serialize_round_trip
(
float
(
"nan"
))))
self
.
assertSerializedEqual
(
None
)
self
.
assertSerializedEqual
(
None
)
self
.
assertSerializedEqual
(
b
"foobar"
)
self
.
assertSerializedEqual
(
b
"foobar"
)
string
,
imports
=
MigrationWriter
.
serialize
(
b
"foobar"
)
string
,
imports
=
MigrationWriter
.
serialize
(
b
"foobar"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment