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
047394f7
Kaydet (Commit)
047394f7
authored
Ock 22, 2014
tarafından
Markus Holtermann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #21852 -- Make migration writer serialize iterators
üst
088cb711
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
writer.py
django/db/migrations/writer.py
+11
-0
test_writer.py
tests/migrations/test_writer.py
+7
-0
No files found.
django/db/migrations/writer.py
Dosyayı görüntüle @
047394f7
...
...
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
import
datetime
import
inspect
import
decimal
import
collections
from
importlib
import
import_module
import
os
import
types
...
...
@@ -257,6 +258,16 @@ class MigrationWriter(object):
if
hasattr
(
value
,
"__module__"
):
module
=
value
.
__module__
return
"
%
s.
%
s"
%
(
module
,
value
.
__name__
),
set
([
"import
%
s"
%
module
])
# Other iterables
elif
isinstance
(
value
,
collections
.
Iterable
):
imports
=
set
()
strings
=
[]
for
item
in
value
:
item_string
,
item_imports
=
cls
.
serialize
(
item
)
imports
.
update
(
item_imports
)
strings
.
append
(
item_string
)
format
=
"(
%
s)"
if
len
(
strings
)
>
1
else
"(
%
s,)"
return
format
%
(
", "
.
join
(
strings
)),
imports
# Uh oh.
else
:
raise
ValueError
(
"Cannot serialize:
%
r
\n
There are some values Django cannot serialize into migration files.
\n
For more, see https://docs.djangoproject.com/en/dev/topics/migrations/#migration-serializing"
%
value
)
...
...
tests/migrations/test_writer.py
Dosyayı görüntüle @
047394f7
...
...
@@ -102,6 +102,13 @@ class WriterTests(TestCase):
set
([
"from django.conf import settings"
]),
)
)
self
.
assertSerializedResultEqual
(
((
x
,
x
*
x
)
for
x
in
range
(
3
)),
(
"((0, 0), (1, 1), (2, 4))"
,
set
(),
)
)
def
test_simple_migration
(
self
):
"""
...
...
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