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
abc11b0a
Kaydet (Commit)
abc11b0a
authored
Eyl 18, 2014
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #23514 -- Prevented queries in PostGISOperations init
Thanks Mattia Procopio for the report.
üst
4dcfacb5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
10 deletions
+33
-10
operations.py
django/contrib/gis/db/backends/postgis/operations.py
+25
-10
tests.py
tests/backends/tests.py
+8
-0
No files found.
django/contrib/gis/db/backends/postgis/operations.py
Dosyayı görüntüle @
abc11b0a
...
...
@@ -176,10 +176,6 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
'bboverlaps'
:
PostGISOperator
(
'&&'
),
}
# Native geometry type support added in PostGIS 2.0.
if
self
.
spatial_version
>=
(
2
,
0
,
0
):
self
.
geometry
=
True
# Creating a dictionary lookup of all GIS terms for PostGIS.
self
.
gis_terms
=
set
([
'isnull'
])
self
.
gis_terms
.
update
(
self
.
geometry_operators
)
...
...
@@ -220,14 +216,33 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
self
.
union
=
prefix
+
'Union'
self
.
unionagg
=
prefix
+
'Union'
# Following "attributes" are properties due to the spatial_version check and
# to delay database access
@property
def
extent3d
(
self
):
if
self
.
spatial_version
>=
(
2
,
0
,
0
):
return
self
.
geom_func_prefix
+
'3DExtent'
else
:
return
self
.
geom_func_prefix
+
'Extent3D'
@property
def
length3d
(
self
):
if
self
.
spatial_version
>=
(
2
,
0
,
0
):
self
.
extent3d
=
prefix
+
'3DExtent'
self
.
length3d
=
prefix
+
'3DLength'
self
.
perimeter3d
=
prefix
+
'3DPerimeter'
return
self
.
geom_func_prefix
+
'3DLength'
else
:
self
.
extent3d
=
prefix
+
'Extent3D'
self
.
length3d
=
prefix
+
'Length3D'
self
.
perimeter3d
=
prefix
+
'Perimeter3D'
return
self
.
geom_func_prefix
+
'Length3D'
@property
def
perimeter3d
(
self
):
if
self
.
spatial_version
>=
(
2
,
0
,
0
):
return
self
.
geom_func_prefix
+
'3DPerimeter'
else
:
return
self
.
geom_func_prefix
+
'Perimeter3D'
@property
def
geometry
(
self
):
# Native geometry type support added in PostGIS 2.0.
return
self
.
spatial_version
>=
(
2
,
0
,
0
)
@cached_property
def
spatial_version
(
self
):
...
...
tests/backends/tests.py
Dosyayı görüntüle @
abc11b0a
...
...
@@ -571,6 +571,14 @@ class BackendTestCase(TestCase):
self
.
assertTrue
(
hasattr
(
connection
.
ops
,
'connection'
))
self
.
assertEqual
(
connection
,
connection
.
ops
.
connection
)
def
test_database_operations_init
(
self
):
"""
Test that DatabaseOperations initialization doesn't query the database.
See #17656.
"""
with
self
.
assertNumQueries
(
0
):
connection
.
ops
.
__class__
(
connection
)
def
test_cached_db_features
(
self
):
self
.
assertIn
(
connection
.
features
.
supports_transactions
,
(
True
,
False
))
self
.
assertIn
(
connection
.
features
.
supports_stddev
,
(
True
,
False
))
...
...
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