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
35e8dc51
Kaydet (Commit)
35e8dc51
authored
Eki 06, 2012
tarafından
Ramiro Morales
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed ad-hoc support for usage of short names of built-in DB backends.
This non-standard naming was deprecated in Django 1.2.
üst
ab232937
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
23 deletions
+7
-23
utils.py
django/db/utils.py
+7
-16
tests.py
tests/regressiontests/backends/tests.py
+0
-7
No files found.
django/db/utils.py
Dosyayı görüntüle @
35e8dc51
...
...
@@ -28,28 +28,19 @@ def load_backend(backend_name):
# listing all possible (built-in) database backends.
backend_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'backends'
)
try
:
available
_backends
=
[
f
for
f
in
os
.
listdir
(
backend_dir
)
builtin
_backends
=
[
f
for
f
in
os
.
listdir
(
backend_dir
)
if
os
.
path
.
isdir
(
os
.
path
.
join
(
backend_dir
,
f
))
and
not
(
f
.
startswith
(
'.'
)
or
f
==
'__pycache__'
)]
and
not
(
f
.
startswith
(
'.'
)
or
f
in
(
'__pycache__'
,
'dummy'
)
)]
except
EnvironmentError
:
available_backends
=
[]
full_notation
=
backend_name
.
startswith
(
'django.db.backends.'
)
if
full_notation
:
backend_name
=
backend_name
[
19
:]
# See #15621.
if
backend_name
not
in
available_backends
:
backend_reprs
=
map
(
repr
,
sorted
(
available_backends
))
builtin_backends
=
[]
if
backend_name
not
in
[
'django.db.backends.
%
s'
%
b
for
b
in
builtin_backends
]:
backend_reprs
=
map
(
repr
,
sorted
(
builtin_backends
))
error_msg
=
(
"
%
r isn't an available database backend.
\n
"
"Try using
django.db.backends.XXX
, where XXX "
"Try using
'django.db.backends.XXX'
, where XXX "
"is one of:
\n
%
s
\n
Error was:
%
s"
%
(
backend_name
,
", "
.
join
(
backend_reprs
),
e_user
))
raise
ImproperlyConfigured
(
error_msg
)
elif
not
full_notation
:
# user tried to use the old notation for the database backend
error_msg
=
(
"
%
r isn't an available database backend.
\n
"
"Try using django.db.backends.
%
s instead.
\n
"
"Error was:
%
s"
%
(
backend_name
,
backend_name
,
e_user
))
raise
ImproperlyConfigured
(
error_msg
)
else
:
# If there's some other error, this must be an error in Django
raise
...
...
tests/regressiontests/backends/tests.py
Dosyayı görüntüle @
35e8dc51
...
...
@@ -666,13 +666,6 @@ class ThreadTests(TestCase):
self
.
assertEqual
(
len
(
exceptions
),
0
)
class
BackendLoadingTests
(
TestCase
):
def
test_old_style_backends_raise_useful_exception
(
self
):
six
.
assertRaisesRegex
(
self
,
ImproperlyConfigured
,
"Try using django.db.backends.sqlite3 instead"
,
load_backend
,
'sqlite3'
)
class
MySQLPKZeroTests
(
TestCase
):
"""
Zero as id for AutoField should raise exception in MySQL, because MySQL
...
...
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