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
1adb7b3c
Kaydet (Commit)
1adb7b3c
authored
Mar 11, 2013
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Ported layermapping for autocommit.
üst
3710a918
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
layermapping.py
django/contrib/gis/utils/layermapping.py
+8
-11
No files found.
django/contrib/gis/utils/layermapping.py
Dosyayı görüntüle @
1adb7b3c
...
...
@@ -59,11 +59,6 @@ class LayerMapping(object):
models
.
PositiveSmallIntegerField
:
(
OFTInteger
,
OFTReal
,
OFTString
),
}
# The acceptable transaction modes.
TRANSACTION_MODES
=
{
'autocommit'
:
transaction
.
autocommit
,
'commit_on_success'
:
transaction
.
commit_on_success
,
}
def
__init__
(
self
,
model
,
data
,
mapping
,
layer
=
0
,
source_srs
=
None
,
encoding
=
'utf-8'
,
transaction_mode
=
'commit_on_success'
,
...
...
@@ -127,9 +122,11 @@ class LayerMapping(object):
# Setting the transaction decorator with the function in the
# transaction modes dictionary.
if
transaction_mode
in
self
.
TRANSACTION_MODES
:
self
.
transaction_decorator
=
self
.
TRANSACTION_MODES
[
transaction_mode
]
self
.
transaction_mode
=
transaction_mode
self
.
transaction_mode
=
transaction_mode
if
transaction_mode
==
'autocommit'
:
self
.
transaction_decorator
=
None
elif
transaction_mode
==
'commit_on_success'
:
self
.
transaction_decorator
=
transaction
.
atomic
else
:
raise
LayerMapError
(
'Unrecognized transaction mode:
%
s'
%
transaction_mode
)
...
...
@@ -501,9 +498,6 @@ class LayerMapping(object):
else
:
progress_interval
=
progress
# Defining the 'real' save method, utilizing the transaction
# decorator created during initialization.
@self.transaction_decorator
def
_save
(
feat_range
=
default_range
,
num_feat
=
0
,
num_saved
=
0
):
if
feat_range
:
layer_iter
=
self
.
layer
[
feat_range
]
...
...
@@ -572,6 +566,9 @@ class LayerMapping(object):
# values returned here.
return
num_saved
,
num_feat
if
self
.
transaction_decorator
is
not
None
:
_save
=
self
.
transaction_decorator
(
_save
)
nfeat
=
self
.
layer
.
num_feat
if
step
and
isinstance
(
step
,
int
)
and
step
<
nfeat
:
# Incremental saving is requested at the given interval (step)
...
...
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