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
46c7707e
Kaydet (Commit)
46c7707e
authored
Agu 19, 2014
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Replaced HAS_SPATIALREFSYS by a database feature
üst
c7fa27d7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
13 deletions
+9
-13
base.py
django/contrib/gis/db/backends/base.py
+1
-0
base.py
django/contrib/gis/db/backends/mysql/base.py
+1
-1
test_spatialrefsys.py
django/contrib/gis/tests/test_spatialrefsys.py
+5
-8
utils.py
django/contrib/gis/tests/utils.py
+0
-2
testcases.py
django/test/testcases.py
+2
-2
No files found.
django/contrib/gis/db/backends/base.py
Dosyayı görüntüle @
46c7707e
...
...
@@ -11,6 +11,7 @@ from django.utils.encoding import python_2_unicode_compatible
class
BaseSpatialFeatures
(
object
):
gis_enabled
=
True
has_spatialrefsys_table
=
True
class
BaseSpatialOperations
(
object
):
...
...
django/contrib/gis/db/backends/mysql/base.py
Dosyayı görüntüle @
46c7707e
...
...
@@ -9,7 +9,7 @@ from django.contrib.gis.db.backends.mysql.operations import MySQLOperations
class
DatabaseFeatures
(
BaseSpatialFeatures
,
MySQLDatabaseFeatures
):
pass
has_spatialrefsys_table
=
False
class
DatabaseWrapper
(
MySQLDatabaseWrapper
):
...
...
django/contrib/gis/tests/test_spatialrefsys.py
Dosyayı görüntüle @
46c7707e
import
unittest
from
django.contrib.gis.gdal
import
HAS_GDAL
from
django.contrib.gis.tests.utils
import
(
no_mysql
,
oracle
,
postgis
,
spatialite
,
HAS_SPATIALREFSYS
,
SpatialRefSys
)
from
django.contrib.gis.tests.utils
import
(
oracle
,
postgis
,
spatialite
,
SpatialRefSys
)
from
django.db
import
connection
from
django.test
import
skipUnlessDBFeature
from
django.utils
import
six
...
...
@@ -34,11 +35,10 @@ test_srs = ({'srid': 4326,
)
@unittest.skipUnless
(
HAS_GDAL
and
HAS_SPATIALREFSYS
,
"SpatialRefSysTest needs gdal support and a spatial databas
e"
)
@unittest.skipUnless
(
HAS_GDAL
,
"SpatialRefSysTest needs gdal support"
)
@skipUnlessDBFeature
(
"has_spatialrefsys_tabl
e"
)
class
SpatialRefSysTest
(
unittest
.
TestCase
):
@no_mysql
def
test_retrieve
(
self
):
"""
Test retrieval of SpatialRefSys model objects.
...
...
@@ -61,7 +61,6 @@ class SpatialRefSysTest(unittest.TestCase):
self
.
assertTrue
(
srs
.
wkt
.
startswith
(
sd
[
'srtext'
]))
six
.
assertRegex
(
self
,
srs
.
proj4text
,
sd
[
'proj4_re'
])
@no_mysql
def
test_osr
(
self
):
"""
Test getting OSR objects from SpatialRefSys model objects.
...
...
@@ -85,7 +84,6 @@ class SpatialRefSysTest(unittest.TestCase):
if
not
spatialite
or
connection
.
ops
.
spatial_version
[
0
]
>=
4
:
self
.
assertTrue
(
srs
.
wkt
.
startswith
(
sd
[
'srtext'
]))
@no_mysql
def
test_ellipsoid
(
self
):
"""
Test the ellipsoid property.
...
...
@@ -102,7 +100,6 @@ class SpatialRefSysTest(unittest.TestCase):
for
i
in
range
(
3
):
self
.
assertAlmostEqual
(
ellps1
[
i
],
ellps2
[
i
],
prec
[
i
])
@no_mysql
def
test_add_entry
(
self
):
"""
Test adding a new entry in the SpatialRefSys model using the
...
...
django/contrib/gis/tests/utils.py
Dosyayı görüntüle @
46c7707e
...
...
@@ -39,7 +39,6 @@ postgis = _default_db == 'postgis'
mysql
=
_default_db
==
'mysql'
spatialite
=
_default_db
==
'spatialite'
HAS_SPATIALREFSYS
=
True
if
oracle
and
'gis'
in
settings
.
DATABASES
[
DEFAULT_DB_ALIAS
][
'ENGINE'
]:
from
django.contrib.gis.db.backends.oracle.models
import
OracleSpatialRefSys
as
SpatialRefSys
elif
postgis
:
...
...
@@ -47,5 +46,4 @@ elif postgis:
elif
spatialite
:
from
django.contrib.gis.db.backends.spatialite.models
import
SpatialiteSpatialRefSys
as
SpatialRefSys
else
:
HAS_SPATIALREFSYS
=
False
SpatialRefSys
=
None
django/test/testcases.py
Dosyayı görüntüle @
46c7707e
...
...
@@ -980,7 +980,7 @@ def skipIfDBFeature(feature):
"""
Skip a test if a database has the named feature
"""
return
_deferredSkip
(
lambda
:
getattr
(
connection
.
features
,
feature
),
return
_deferredSkip
(
lambda
:
getattr
(
connection
.
features
,
feature
,
False
),
"Database has feature
%
s"
%
feature
)
...
...
@@ -988,7 +988,7 @@ def skipUnlessDBFeature(feature):
"""
Skip a test unless a database has the named feature
"""
return
_deferredSkip
(
lambda
:
not
getattr
(
connection
.
features
,
feature
),
return
_deferredSkip
(
lambda
:
not
getattr
(
connection
.
features
,
feature
,
False
),
"Database doesn't support feature
%
s"
%
feature
)
...
...
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