Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
I
inary
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)
1
Konular (issue)
1
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ç
SulinOS
inary
Commits
df7be7b5
Kaydet (Commit)
df7be7b5
authored
Eki 24, 2005
tarafından
Eray Özkural
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
* smart constructor that falls back to read-only access when there
aren't sufficient permissions
üst
5fd8c62d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
lockeddbshelve.py
pisi/lockeddbshelve.py
+8
-2
No files found.
pisi/lockeddbshelve.py
Dosyayı görüntüle @
df7be7b5
...
...
@@ -30,17 +30,23 @@ class Error(pisi.Error):
class
LockedDBShelf
(
shelve
.
DBShelf
):
"""A simple wrapper to implement locking for bsddb's dbshelf"""
def
__init__
(
self
,
dbname
,
flags
=
db
.
DB_CREATE
,
mode
=
0660
,
def
__init__
(
self
,
dbname
,
mode
=
0660
,
filetype
=
db
.
DB_HASH
,
dbenv
=
None
):
shelve
.
DBShelf
.
__init__
(
self
,
dbenv
)
filename
=
os
.
path
.
join
(
pisi
.
context
.
config
.
db_dir
(),
dbname
+
'.bdb'
)
if
os
.
access
(
os
.
path
.
dirname
(
filename
),
os
.
W_OK
):
flags
=
'w'
elif
os
.
access
(
filename
,
os
.
R_OK
):
flags
=
'r'
else
:
raise
Error
(
_
(
'Cannot attain read or write access to database
%
s'
)
%
dbname
)
self
.
open
(
filename
,
dbname
,
filetype
,
flags
,
mode
)
def
__del__
(
self
):
# superclass does something funky, we don't need that
pass
def
open
(
self
,
filename
,
dbname
,
filetype
,
flags
,
mode
):
def
open
(
self
,
filename
,
dbname
,
filetype
,
flags
=
db
.
DB_CREATE
,
mode
=
0660
):
self
.
filename
=
filename
self
.
closed
=
False
#print 'open', filename
...
...
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