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
f82be9eb
Unverified
Kaydet (Commit)
f82be9eb
authored
Kas 10, 2018
tarafından
Tim Graham
Kaydeden (comit)
GitHub
Kas 10, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29934 -- Added sqlparse as a require dependency.
üst
f9ff1df1
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
48 deletions
+16
-48
features.py
django/db/backends/base/features.py
+0
-4
operations.py
django/db/backends/base/operations.py
+6
-11
features.py
django/db/backends/postgresql/features.py
+0
-1
unit-tests.txt
docs/internals/contributing/writing-code/unit-tests.txt
+1
-1
migration-operations.txt
docs/ref/migration-operations.txt
+1
-4
2.2.txt
docs/releases/2.2.txt
+7
-0
setup.py
setup.py
+1
-1
test_commands.py
tests/migrations/test_commands.py
+0
-8
test_multidb.py
tests/migrations/test_multidb.py
+0
-9
test_operations.py
tests/migrations/test_operations.py
+0
-9
No files found.
django/db/backends/base/features.py
Dosyayı görüntüle @
f82be9eb
...
@@ -194,10 +194,6 @@ class BaseDatabaseFeatures:
...
@@ -194,10 +194,6 @@ class BaseDatabaseFeatures:
# Does 'a' LIKE 'A' match?
# Does 'a' LIKE 'A' match?
has_case_insensitive_like
=
True
has_case_insensitive_like
=
True
# Does the backend require the sqlparse library for splitting multi-line
# statements before executing them?
requires_sqlparse_for_splitting
=
True
# Suffix for backends that don't support "SELECT xxx;" queries.
# Suffix for backends that don't support "SELECT xxx;" queries.
bare_select_suffix
=
''
bare_select_suffix
=
''
...
...
django/db/backends/base/operations.py
Dosyayı görüntüle @
f82be9eb
...
@@ -2,8 +2,9 @@ import datetime
...
@@ -2,8 +2,9 @@ import datetime
import
decimal
import
decimal
from
importlib
import
import_module
from
importlib
import
import_module
import
sqlparse
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.exceptions
import
ImproperlyConfigured
from
django.db
import
NotSupportedError
,
transaction
from
django.db
import
NotSupportedError
,
transaction
from
django.db.backends
import
utils
from
django.db.backends
import
utils
from
django.utils
import
timezone
from
django.utils
import
timezone
...
@@ -298,16 +299,10 @@ class BaseDatabaseOperations:
...
@@ -298,16 +299,10 @@ class BaseDatabaseOperations:
cursor.execute() call and PEP 249 doesn't talk about this use case,
cursor.execute() call and PEP 249 doesn't talk about this use case,
the default implementation is conservative.
the default implementation is conservative.
"""
"""
try
:
return
[
import
sqlparse
sqlparse
.
format
(
statement
,
strip_comments
=
True
)
except
ImportError
:
for
statement
in
sqlparse
.
split
(
sql
)
if
statement
raise
ImproperlyConfigured
(
]
"The sqlparse package is required if you don't split your SQL "
"statements manually."
)
else
:
return
[
sqlparse
.
format
(
statement
,
strip_comments
=
True
)
for
statement
in
sqlparse
.
split
(
sql
)
if
statement
]
def
process_clob
(
self
,
value
):
def
process_clob
(
self
,
value
):
"""
"""
...
...
django/db/backends/postgresql/features.py
Dosyayı görüntüle @
f82be9eb
...
@@ -26,7 +26,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
...
@@ -26,7 +26,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
nulls_order_largest
=
True
nulls_order_largest
=
True
closed_cursor_error_class
=
InterfaceError
closed_cursor_error_class
=
InterfaceError
has_case_insensitive_like
=
False
has_case_insensitive_like
=
False
requires_sqlparse_for_splitting
=
False
greatest_least_ignores_nulls
=
True
greatest_least_ignores_nulls
=
True
can_clone_databases
=
True
can_clone_databases
=
True
supports_temporal_subtraction
=
True
supports_temporal_subtraction
=
True
...
...
docs/internals/contributing/writing-code/unit-tests.txt
Dosyayı görüntüle @
f82be9eb
...
@@ -233,7 +233,7 @@ dependencies:
...
@@ -233,7 +233,7 @@ dependencies:
* memcached_, plus a :ref:`supported Python binding <memcached>`
* memcached_, plus a :ref:`supported Python binding <memcached>`
* gettext_ (:ref:`gettext_on_windows`)
* gettext_ (:ref:`gettext_on_windows`)
* selenium_
* selenium_
* sqlparse_
* sqlparse_
(required)
You can find these dependencies in `pip requirements files`_ inside the
You can find these dependencies in `pip requirements files`_ inside the
``tests/requirements`` directory of the Django source tree and install them
``tests/requirements`` directory of the Django source tree and install them
...
...
docs/ref/migration-operations.txt
Dosyayı görüntüle @
f82be9eb
...
@@ -240,8 +240,7 @@ partial indexes.
...
@@ -240,8 +240,7 @@ partial indexes.
``sql``, and ``reverse_sql`` if provided, should be strings of SQL to run on
``sql``, and ``reverse_sql`` if provided, should be strings of SQL to run on
the database. On most database backends (all but PostgreSQL), Django will
the database. On most database backends (all but PostgreSQL), Django will
split the SQL into individual statements prior to executing them. This
split the SQL into individual statements prior to executing them.
requires installing the sqlparse_ Python library.
You can also pass a list of strings or 2-tuples. The latter is used for passing
You can also pass a list of strings or 2-tuples. The latter is used for passing
queries and parameters in the same way as :ref:`cursor.execute()
queries and parameters in the same way as :ref:`cursor.execute()
...
@@ -294,8 +293,6 @@ be removed (elided) when :ref:`squashing migrations <migration-squashing>`.
...
@@ -294,8 +293,6 @@ be removed (elided) when :ref:`squashing migrations <migration-squashing>`.
want the operation not to do anything in the given direction. This is
want the operation not to do anything in the given direction. This is
especially useful in making the operation reversible.
especially useful in making the operation reversible.
.. _sqlparse: https://pypi.org/project/sqlparse/
``RunPython``
``RunPython``
-------------
-------------
...
...
docs/releases/2.2.txt
Dosyayı görüntüle @
f82be9eb
...
@@ -330,6 +330,13 @@ properly (the database was empty at the end of the whole test suite). This
...
@@ -330,6 +330,13 @@ properly (the database was empty at the end of the whole test suite). This
change shouldn't have an impact on your tests unless you've customized
change shouldn't have an impact on your tests unless you've customized
:class:`~django.test.TransactionTestCase`'s internals.
:class:`~django.test.TransactionTestCase`'s internals.
``sqlparse`` is required dependency
-----------------------------------
To simplify a few parts of Django's database handling, `sqlparse
<https://pypi.org/project/sqlparse/>`_ is now a required dependency. It's
automatically installed along with Django.
Miscellaneous
Miscellaneous
-------------
-------------
...
...
setup.py
Dosyayı görüntüle @
f82be9eb
...
@@ -83,7 +83,7 @@ setup(
...
@@ -83,7 +83,7 @@ setup(
entry_points
=
{
'console_scripts'
:
[
entry_points
=
{
'console_scripts'
:
[
'django-admin = django.core.management:execute_from_command_line'
,
'django-admin = django.core.management:execute_from_command_line'
,
]},
]},
install_requires
=
[
'pytz'
],
install_requires
=
[
'pytz'
,
'sqlparse'
],
extras_require
=
{
extras_require
=
{
"bcrypt"
:
[
"bcrypt"
],
"bcrypt"
:
[
"bcrypt"
],
"argon2"
:
[
"argon2-cffi >= 16.1.0"
],
"argon2"
:
[
"argon2-cffi >= 16.1.0"
],
...
...
tests/migrations/test_commands.py
Dosyayı görüntüle @
f82be9eb
...
@@ -20,11 +20,6 @@ from .models import UnicodeModel, UnserializableModel
...
@@ -20,11 +20,6 @@ from .models import UnicodeModel, UnserializableModel
from
.routers
import
TestRouter
from
.routers
import
TestRouter
from
.test_base
import
MigrationTestBase
from
.test_base
import
MigrationTestBase
try
:
import
sqlparse
except
ImportError
:
sqlparse
=
None
class
MigrateTests
(
MigrationTestBase
):
class
MigrateTests
(
MigrationTestBase
):
"""
"""
...
@@ -355,9 +350,6 @@ class MigrateTests(MigrationTestBase):
...
@@ -355,9 +350,6 @@ class MigrateTests(MigrationTestBase):
out
.
getvalue
()
out
.
getvalue
()
)
)
# Show the plan when an operation is irreversible.
# Show the plan when an operation is irreversible.
# Migration 0004's RunSQL uses a SQL string instead of a list, so
# sqlparse may be required for splitting.
if
sqlparse
or
not
connection
.
features
.
requires_sqlparse_for_splitting
:
# Migrate to the fourth migration.
# Migrate to the fourth migration.
call_command
(
'migrate'
,
'migrations'
,
'0004'
,
verbosity
=
0
)
call_command
(
'migrate'
,
'migrations'
,
'0004'
,
verbosity
=
0
)
out
=
io
.
StringIO
()
out
=
io
.
StringIO
()
...
...
tests/migrations/test_multidb.py
Dosyayı görüntüle @
f82be9eb
import
unittest
from
django.db
import
connection
,
migrations
,
models
from
django.db
import
connection
,
migrations
,
models
from
django.db.migrations.state
import
ProjectState
from
django.db.migrations.state
import
ProjectState
from
django.test
import
override_settings
from
django.test
import
override_settings
from
.test_operations
import
OperationTestBase
from
.test_operations
import
OperationTestBase
try
:
import
sqlparse
except
ImportError
:
sqlparse
=
None
class
AgnosticRouter
:
class
AgnosticRouter
:
"""
"""
...
@@ -128,12 +121,10 @@ class MultiDBOperationTests(OperationTestBase):
...
@@ -128,12 +121,10 @@ class MultiDBOperationTests(OperationTestBase):
else
:
else
:
self
.
assertEqual
(
Pony
.
objects
.
count
(),
0
)
self
.
assertEqual
(
Pony
.
objects
.
count
(),
0
)
@unittest.skipIf
(
sqlparse
is
None
and
connection
.
features
.
requires_sqlparse_for_splitting
,
"Missing sqlparse"
)
@override_settings
(
DATABASE_ROUTERS
=
[
MigrateNothingRouter
()])
@override_settings
(
DATABASE_ROUTERS
=
[
MigrateNothingRouter
()])
def
test_run_sql
(
self
):
def
test_run_sql
(
self
):
self
.
_test_run_sql
(
"test_mltdb_runsql"
,
should_run
=
False
)
self
.
_test_run_sql
(
"test_mltdb_runsql"
,
should_run
=
False
)
@unittest.skipIf
(
sqlparse
is
None
and
connection
.
features
.
requires_sqlparse_for_splitting
,
"Missing sqlparse"
)
@override_settings
(
DATABASE_ROUTERS
=
[
MigrateWhenFooRouter
()])
@override_settings
(
DATABASE_ROUTERS
=
[
MigrateWhenFooRouter
()])
def
test_run_sql2
(
self
):
def
test_run_sql2
(
self
):
self
.
_test_run_sql
(
"test_mltdb_runsql2"
,
should_run
=
False
)
self
.
_test_run_sql
(
"test_mltdb_runsql2"
,
should_run
=
False
)
...
...
tests/migrations/test_operations.py
Dosyayı görüntüle @
f82be9eb
import
unittest
from
django.core.exceptions
import
FieldDoesNotExist
from
django.core.exceptions
import
FieldDoesNotExist
from
django.db
import
connection
,
migrations
,
models
,
transaction
from
django.db
import
connection
,
migrations
,
models
,
transaction
from
django.db.migrations.migration
import
Migration
from
django.db.migrations.migration
import
Migration
...
@@ -14,11 +12,6 @@ from django.test import SimpleTestCase, override_settings, skipUnlessDBFeature
...
@@ -14,11 +12,6 @@ from django.test import SimpleTestCase, override_settings, skipUnlessDBFeature
from
.models
import
FoodManager
,
FoodQuerySet
,
UnicodeModel
from
.models
import
FoodManager
,
FoodQuerySet
,
UnicodeModel
from
.test_base
import
MigrationTestBase
from
.test_base
import
MigrationTestBase
try
:
import
sqlparse
except
ImportError
:
sqlparse
=
None
class
Mixin
:
class
Mixin
:
pass
pass
...
@@ -2051,7 +2044,6 @@ class OperationTests(OperationTestBase):
...
@@ -2051,7 +2044,6 @@ class OperationTests(OperationTestBase):
self
.
assertColumnExists
(
"test_afknfk_rider"
,
"pony_id"
)
self
.
assertColumnExists
(
"test_afknfk_rider"
,
"pony_id"
)
self
.
assertColumnNotExists
(
"test_afknfk_rider"
,
"pony"
)
self
.
assertColumnNotExists
(
"test_afknfk_rider"
,
"pony"
)
@unittest.skipIf
(
sqlparse
is
None
and
connection
.
features
.
requires_sqlparse_for_splitting
,
"Missing sqlparse"
)
def
test_run_sql
(
self
):
def
test_run_sql
(
self
):
"""
"""
Tests the RunSQL operation.
Tests the RunSQL operation.
...
@@ -2561,7 +2553,6 @@ class OperationTests(OperationTestBase):
...
@@ -2561,7 +2553,6 @@ class OperationTests(OperationTestBase):
operation
.
database_forwards
(
"test_runpython"
,
editor
,
project_state
,
new_state
)
operation
.
database_forwards
(
"test_runpython"
,
editor
,
project_state
,
new_state
)
operation
.
database_backwards
(
"test_runpython"
,
editor
,
new_state
,
project_state
)
operation
.
database_backwards
(
"test_runpython"
,
editor
,
new_state
,
project_state
)
@unittest.skipIf
(
sqlparse
is
None
and
connection
.
features
.
requires_sqlparse_for_splitting
,
"Missing sqlparse"
)
def
test_separate_database_and_state
(
self
):
def
test_separate_database_and_state
(
self
):
"""
"""
Tests the SeparateDatabaseAndState operation.
Tests the SeparateDatabaseAndState operation.
...
...
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