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
f1cc2be0
Kaydet (Commit)
f1cc2be0
authored
Eki 28, 2012
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #18575 -- Empty DATABASES should default to dummy backend
Thanks delormemarco@gmail.com for the report.
üst
effe96b3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
8 deletions
+22
-8
global_settings.py
django/conf/global_settings.py
+2
-6
__init__.py
django/db/__init__.py
+1
-1
utils.py
django/db/utils.py
+8
-1
tests.py
tests/regressiontests/backends/tests.py
+11
-0
No files found.
django/conf/global_settings.py
Dosyayı görüntüle @
f1cc2be0
...
...
@@ -150,12 +150,8 @@ SERVER_EMAIL = 'root@localhost'
# Whether to send broken-link emails.
SEND_BROKEN_LINK_EMAILS
=
False
# Database connection info.
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.dummy'
,
},
}
# Database connection info. If left empty, will default to the dummy backend.
DATABASES
=
{}
# Classes used to implement DB routing behavior.
DATABASE_ROUTERS
=
[]
...
...
django/db/__init__.py
Dosyayı görüntüle @
f1cc2be0
...
...
@@ -8,7 +8,7 @@ __all__ = ('backend', 'connection', 'connections', 'router', 'DatabaseError',
'IntegrityError'
,
'DEFAULT_DB_ALIAS'
)
if
DEFAULT_DB_ALIAS
not
in
settings
.
DATABASES
:
if
settings
.
DATABASES
and
DEFAULT_DB_ALIAS
not
in
settings
.
DATABASES
:
raise
ImproperlyConfigured
(
"You must define a '
%
s' database"
%
DEFAULT_DB_ALIAS
)
connections
=
ConnectionHandler
(
settings
.
DATABASES
)
...
...
django/db/utils.py
Dosyayı görüntüle @
f1cc2be0
...
...
@@ -53,7 +53,14 @@ class ConnectionDoesNotExist(Exception):
class
ConnectionHandler
(
object
):
def
__init__
(
self
,
databases
):
self
.
databases
=
databases
if
not
databases
:
self
.
databases
=
{
DEFAULT_DB_ALIAS
:
{
'ENGINE'
:
'django.db.backends.dummy'
,
},
}
else
:
self
.
databases
=
databases
self
.
_connections
=
local
()
def
ensure_defaults
(
self
,
alias
):
...
...
tests/regressiontests/backends/tests.py
Dosyayı görüntüle @
f1cc2be0
...
...
@@ -23,6 +23,17 @@ from django.utils import unittest
from
.
import
models
class
DummyBackendTest
(
TestCase
):
def
test_no_databases
(
self
):
"""
Test that empty DATABASES setting default to the dummy backend.
"""
DATABASES
=
{}
conns
=
ConnectionHandler
(
DATABASES
)
self
.
assertEqual
(
conns
[
DEFAULT_DB_ALIAS
]
.
settings_dict
[
'ENGINE'
],
'django.db.backends.dummy'
)
class
OracleChecks
(
unittest
.
TestCase
):
@unittest.skipUnless
(
connection
.
vendor
==
'oracle'
,
...
...
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